Skip to content

Commit 67d4718

Browse files
committed
Compile sources to separate directory for tests
1 parent fee3663 commit 67d4718

File tree

6 files changed

+16
-37
lines changed

6 files changed

+16
-37
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Ignore for example failing-tests.json from AVA
22
node_modules/.cache/
3+
# Build output for tests
4+
lib-test/
35
# Java build files
46
.gradle/
57
*.class

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
// transpiled JavaScript
88
"lib": true,
9+
"lib-test": true,
910
},
1011
// Installing a new Node package often triggers VS Code's git limit warnings as there is typically
1112
// an intermediate stage where many files are modified. This setting suppresses these warnings.

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default [
2727
ignores: [
2828
"**/webpack.config.js",
2929
"lib/**/*",
30+
"lib-test/**/*",
3031
"src/testdata/**/*",
3132
"tests/**/*",
3233
"build.mjs",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"description": "CodeQL action",
66
"scripts": {
77
"build": "node build.mjs",
8-
"test": "ava src/**.test.ts --serial --verbose",
8+
"test": "tsc --project tsconfig.test.json && ava src/**.test.ts --serial --verbose",
99
"test-debug": "ava src/**.test.ts --serial --verbose --timeout=20m",
1010
"lint": "eslint --report-unused-disable-directives --max-warnings=0 .",
1111
"lint-fix": "eslint --report-unused-disable-directives --max-warnings=0 . --fix",
@@ -15,7 +15,7 @@
1515
"ava": {
1616
"typescript": {
1717
"rewritePaths": {
18-
"src/": "lib/"
18+
"src/": "lib-test/"
1919
},
2020
"compile": false
2121
}

tsconfig.json

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
{
22
"compilerOptions": {
33
/* Basic Options */
4-
// "incremental": true, /* Enable incremental compilation */
54
"lib": ["ES2021"],
65
"target": "ES2021",
76
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
8-
// "allowJs": true, /* Allow javascript files to be compiled. */
9-
// "checkJs": true, /* Report errors in .js files. */
10-
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
11-
// "declaration": true, /* Generates corresponding '.d.ts' file. */
12-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
7+
"noEmit": true, /* Do not emit outputs. */
138
"sourceMap": true, /* Generates corresponding '.map' file. */
14-
// "outFile": "./", /* Concatenate and emit output to single file. */
15-
"outDir": "./lib", /* Redirect output structure to the directory. */
16-
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
17-
// "composite": true, /* Enable project compilation */
18-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
19-
// "removeComments": true, /* Do not emit comments to output. */
20-
// "noEmit": true, /* Do not emit outputs. */
21-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
22-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
23-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
249

2510
/* Strict Type-Checking Options */
2611
"strict": true, /* Enable all strict type-checking options. */
@@ -39,27 +24,8 @@
3924
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
4025

4126
/* Module Resolution Options */
42-
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
43-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
44-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
45-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
46-
// "typeRoots": [], /* List of folders to include type definitions from. */
47-
// "types": [], /* Type declaration files to be included in compilation. */
48-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
4927
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
50-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
51-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
5228
"resolveJsonModule": true,
53-
54-
/* Source Map Options */
55-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
56-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
57-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
58-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
59-
60-
/* Experimental Options */
61-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
62-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
6329
},
6430
"exclude": ["node_modules"]
6531
}

tsconfig.test.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"extends": "./tsconfig.json",
4+
"compilerOptions": {
5+
"noEmit": false,
6+
"outDir": "./lib-test",
7+
"rootDir": "./src",
8+
},
9+
}

0 commit comments

Comments
 (0)