Skip to content

Commit 9ec5b21

Browse files
test: run tests in typescript
1 parent 338074d commit 9ec5b21

File tree

86 files changed

+564
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+564
-202
lines changed

package-lock.json

Lines changed: 326 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999
"ts-node": "=10.9.2",
100100
"typescript": "=5.5.4",
101101
"webpack": "=5.99.9",
102-
"webpack-cli": "=6.0.1"
102+
"webpack-cli": "=6.0.1",
103+
"@types/expect": "^1.20.4",
104+
"ts-mocha": "^11.1.0",
105+
"tsconfig-paths": "^4.2.0"
103106
}
104107
}

packages/apidom-ast/.mocharc.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2-
"recursive": true,
3-
"spec": "test/**/*.mjs"
2+
"extensions": ["ts"],
3+
"spec": ["test/**/*.ts"],
4+
"loader": "ts-node/esm",
5+
"recursive": true
46
}

packages/apidom-ast/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
2424
"lint": "eslint ./",
2525
"lint:fix": "eslint ./ --fix",
26-
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
27-
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
26+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types",
27+
"test": "NODE_ENV=test ts-mocha",
2828
"typescript:check-types": "tsc --noEmit",
2929
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
3030
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2+
"extensions": ["ts"],
3+
"loader": "ts-node/esm",
24
"recursive": true,
3-
"spec": "test/**/*.mjs",
4-
"file": ["test/mocha-bootstrap.mjs"]
5+
"spec": "test/**/*.ts",
6+
"file": ["test/mocha-bootstrap.ts"]
57
}

packages/apidom-converter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
2424
"lint": "eslint ./",
2525
"lint:fix": "eslint ./ --fix",
26-
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
26+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types",
2727
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
2828
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
29-
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
29+
"test": "NODE_ENV=test ts-mocha",
3030
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 mocha",
3131
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
3232
"postpack": "rimraf NOTICE LICENSES"

packages/apidom-core/.mocharc.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2+
"extensions": ["ts"],
3+
"loader": "ts-node/esm",
24
"recursive": true,
3-
"spec": "test/**/*.mjs",
4-
"file": ["test/mocha-bootstrap.mjs"]
5+
"spec": "test/**/*.ts",
6+
"file": ["test/mocha-bootstrap.ts"]
57
}

packages/apidom-core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
2727
"lint": "eslint ./",
2828
"lint:fix": "eslint ./ --fix",
29-
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
29+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types",
3030
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
3131
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json && copyfiles -u 2 ../@types/minim.d.ts ./types && node ./scripts/file-replace-bof.js './types/apidom-core.d.ts' '/// <reference path=\"./minim.d.ts\" />\nimport * as minim from \"minim\";'",
32-
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
32+
"test": "NODE_ENV=test ts-mocha",
3333
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 NODE_ENV=test mocha",
3434
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
3535
"postpack": "rimraf NOTICE LICENSES"

packages/apidom-core/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": "../../tsconfig.json",
3+
"ts-node": {
4+
"files": true
5+
},
36
"include": [
47
"src/**/*",
58
"../@types/**/*.d.ts"

packages/apidom-error/.mocharc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"extensions": ["ts"],
3+
"loader": "ts-node/esm",
24
"recursive": true,
3-
"spec": "test/**/*.mjs"
5+
"spec": "test/**/*.ts"
46
}

0 commit comments

Comments
 (0)