diff --git a/.vscode/launch.json b/.vscode/launch.json index 7663b9048d..8dec3a74cd 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Stryker unit tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -26,8 +24,6 @@ "name": "Stryker-mocha-framework unit tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -42,8 +38,6 @@ "name": "babel-transpiler unit tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -58,8 +52,6 @@ "name": "javascript-mutator unit tests", "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/helpers/bootstrap-local-dependencies.ts b/helpers/bootstrap-local-dependencies.ts index ec41de7535..25c24d999c 100644 --- a/helpers/bootstrap-local-dependencies.ts +++ b/helpers/bootstrap-local-dependencies.ts @@ -1,5 +1,5 @@ import { ListByPackage, LocalInstaller, progress } from 'install-local'; -import { fs } from 'mz'; +import * as fs from 'fs'; import glob = require('glob'); import path = require('path'); @@ -17,6 +17,16 @@ function globAsPromised(pattern: string, options: glob.IOptions) { }); } +function readFile(fileName: string) { + return new Promise((res, rej) => fs.readFile(fileName, 'utf8', (err, content) => { + if (err) { + rej(err); + } else { + res(content); + } + })); +} + interface Package { localDependencies?: { [name: string]: string }; } @@ -29,7 +39,7 @@ interface Package { export async function bootstrapLocalDependencies(directory: string) { console.log('bootstrap ' + path.resolve(directory)); const files = await globAsPromised('{package.json,test/*/package.json}', { cwd: path.resolve(directory) }); - const packages = await Promise.all(files.map(fileName => fs.readFile(fileName, 'utf8') + const packages = await Promise.all(files.map(fileName => readFile(fileName) .then(content => ({ dir: path.dirname(fileName), content: JSON.parse(content) as Package })))); const sourcesByTarget: ListByPackage = {}; for (const pkg of packages) { diff --git a/package.json b/package.json index 0d11918fe3..c67a84e109 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "jasmine-core": "^3.1.0", "lerna": "^3.10.7", "link-parent-bin": "~1.0.0", - "mocha": "^5.2.0", + "mocha": "^6.1.2", "nyc": "^13.0.1", "rimraf": "^2.6.1", "rxjs": "^6.4.0", @@ -36,8 +36,7 @@ "sinon-chai": "^3.2.0", "source-map-support": "^0.5.6", "tslint": "~5.15.0", - "typescript": "^3.3.1", - "web-component-tester": "6.9.2" + "typescript": "^3.3.1" }, "prettier": { "singleQuote": true diff --git a/packages/api/.vscode/launch.json b/packages/api/.vscode/launch.json index fa1c133469..090eaac215 100644 --- a/packages/api/.vscode/launch.json +++ b/packages/api/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -27,8 +25,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/babel-transpiler/.vscode/launch.json b/packages/babel-transpiler/.vscode/launch.json index 754e131bbb..015f50a5c7 100644 --- a/packages/babel-transpiler/.vscode/launch.json +++ b/packages/babel-transpiler/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -26,8 +24,6 @@ "name": "Integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/core/.vscode/launch.json b/packages/core/.vscode/launch.json index 35cab8d458..8c8fbd9f80 100644 --- a/packages/core/.vscode/launch.json +++ b/packages/core/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -55,8 +53,6 @@ "name": "Integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/html-reporter/.vscode/launch.json b/packages/html-reporter/.vscode/launch.json index 05ecdf854a..4bcde6fd7b 100644 --- a/packages/html-reporter/.vscode/launch.json +++ b/packages/html-reporter/.vscode/launch.json @@ -23,8 +23,6 @@ "name": "Run unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -43,8 +41,6 @@ "name": "Run integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/jasmine-framework/.vscode/launch.json b/packages/jasmine-framework/.vscode/launch.json index a949b9d86f..570048043d 100644 --- a/packages/jasmine-framework/.vscode/launch.json +++ b/packages/jasmine-framework/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Unit tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -30,8 +28,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/jasmine-runner/.vscode/launch.json b/packages/jasmine-runner/.vscode/launch.json index a949b9d86f..570048043d 100644 --- a/packages/jasmine-runner/.vscode/launch.json +++ b/packages/jasmine-runner/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Unit tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -30,8 +28,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/javascript-mutator/.vscode/launch.json b/packages/javascript-mutator/.vscode/launch.json index 754e131bbb..015f50a5c7 100644 --- a/packages/javascript-mutator/.vscode/launch.json +++ b/packages/javascript-mutator/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -26,8 +24,6 @@ "name": "Integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/jest-runner/.vscode/launch.json b/packages/jest-runner/.vscode/launch.json index a949b9d86f..570048043d 100644 --- a/packages/jest-runner/.vscode/launch.json +++ b/packages/jest-runner/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Unit tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -30,8 +28,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/karma-runner/.vscode/launch.json b/packages/karma-runner/.vscode/launch.json index 0217431bfa..c139f57d7b 100644 --- a/packages/karma-runner/.vscode/launch.json +++ b/packages/karma-runner/.vscode/launch.json @@ -18,8 +18,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -38,8 +36,6 @@ "name": "Integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/mocha-runner/.vscode/launch.json b/packages/mocha-runner/.vscode/launch.json index a949b9d86f..570048043d 100644 --- a/packages/mocha-runner/.vscode/launch.json +++ b/packages/mocha-runner/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Unit tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -30,8 +28,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/typescript/.vscode/launch.json b/packages/typescript/.vscode/launch.json index 754e131bbb..015f50a5c7 100644 --- a/packages/typescript/.vscode/launch.json +++ b/packages/typescript/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -26,8 +24,6 @@ "name": "Integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/util/.vscode/launch.json b/packages/util/.vscode/launch.json index a949b9d86f..570048043d 100644 --- a/packages/util/.vscode/launch.json +++ b/packages/util/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Unit tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -30,8 +28,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/vue-mutator/.vscode/launch.json b/packages/vue-mutator/.vscode/launch.json index 754e131bbb..015f50a5c7 100644 --- a/packages/vue-mutator/.vscode/launch.json +++ b/packages/vue-mutator/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Unit tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -26,8 +24,6 @@ "name": "Integration tests", "program": "${workspaceRoot}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/wct-runner/.vscode/launch.json b/packages/wct-runner/.vscode/launch.json index a93c44ec43..88b32c3498 100644 --- a/packages/wct-runner/.vscode/launch.json +++ b/packages/wct-runner/.vscode/launch.json @@ -7,8 +7,6 @@ "name": "Integration test", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -31,8 +29,6 @@ "name": "Unit test", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", diff --git a/packages/wct-runner/package.json b/packages/wct-runner/package.json index 40b17ddd48..3a259238b4 100644 --- a/packages/wct-runner/package.json +++ b/packages/wct-runner/package.json @@ -28,7 +28,11 @@ }, "devDependencies": { "@stryker-mutator/test-helpers": "^1.2.0", - "@types/socket.io": "^2.1.0" + "@types/socket.io": "^2.1.0", + "chai": "~4.2.0", + "mocha": "~5.2.0", + "sinon": "^7.3.1", + "web-component-tester": "~6.9.2" }, "peerDependencies": { "@stryker-mutator/core": "^1.0.0", diff --git a/packages/wct-runner/test/integration/WctTestRunner.it.spec.ts b/packages/wct-runner/test/integration/WctTestRunner.it.spec.ts index f89879c66d..f1af00edf8 100644 --- a/packages/wct-runner/test/integration/WctTestRunner.it.spec.ts +++ b/packages/wct-runner/test/integration/WctTestRunner.it.spec.ts @@ -16,7 +16,7 @@ describe('WctTestRunner integration', () => { // The "root" wct configuration option is always loaded from the current directory. // In order to test it properly, we need to grab it before- and reset it after each test. let cwd: string; - const root = path.resolve(__dirname, '..', '..', '..', '..'); + const root = path.resolve(__dirname, '..', '..'); function createSut(): WctTestRunner { return testInjector.injector.injectClass(WctTestRunner); @@ -27,7 +27,7 @@ describe('WctTestRunner integration', () => { tests: [ { name: ' is awesome', status: TestStatus.Success, failureMessages: undefined }, { name: ' is failing', status: TestStatus.Failed, failureMessages: ['expected true to be false'] }, - { name: ' is throwing', status: TestStatus.Failed, failureMessages: ['This element is failing HTMLElement.throw at /components/stryker-parent/packages/wct-runner/testResources/htmlTestSuite/src/failing-element.js:11'] } + { name: ' is throwing', status: TestStatus.Failed, failureMessages: ['This element is failing HTMLElement.throw at /components/@stryker-mutator/wct-runner/testResources/htmlTestSuite/src/failing-element.js:11'] } ] }; // To enable console logging: LoggerFactory.setLogImplementation(consoleLoggerFactory); @@ -104,7 +104,7 @@ describe('WctTestRunner integration', () => { const sut = createSut(); const expectedResult: TimelessRunResult = { status: RunStatus.Complete, // We want to actually expect an error here, but wct doesn't let is. - tests: [{ name: '', status: TestStatus.Failed, failureMessages: ['Random error at /components/stryker-parent/packages/wct-runner/testResources/garbage/test/gargbage-tests.js:1'] }] + tests: [{ name: '', status: TestStatus.Failed, failureMessages: ['Random error at /components/@stryker-mutator/wct-runner/testResources/garbage/test/gargbage-tests.js:1'] }] }; // Act diff --git a/packages/wct-runner/testResources/garbage/wct.conf.json b/packages/wct-runner/testResources/garbage/wct.conf.json index 81350ac8f6..7881715d64 100644 --- a/packages/wct-runner/testResources/garbage/wct.conf.json +++ b/packages/wct-runner/testResources/garbage/wct.conf.json @@ -1,6 +1,6 @@ { "verbose": true, - "suites": ["packages/wct-runner/testResources/garbage/test"], + "suites": ["testResources/garbage/test"], "plugins": { "local": { "browsers": ["chrome"], @@ -12,5 +12,5 @@ } }, "npm": true, - "root": "../../../../.." + "root": "../../.." } \ No newline at end of file diff --git a/packages/wct-runner/testResources/htmlTestSuite/wct.conf.json b/packages/wct-runner/testResources/htmlTestSuite/wct.conf.json index d36e953993..48dd307a62 100644 --- a/packages/wct-runner/testResources/htmlTestSuite/wct.conf.json +++ b/packages/wct-runner/testResources/htmlTestSuite/wct.conf.json @@ -1,7 +1,7 @@ { "verbose": true, "suites": [ - "packages/wct-runner/testResources/htmlTestSuite/test" + "testResources/htmlTestSuite/test" ], "plugins": { "local": { @@ -16,5 +16,5 @@ } }, "npm": true, - "root": "../../../.." + "root": "../.." } \ No newline at end of file diff --git a/packages/wct-runner/testResources/jsTestSuite/wct.conf.json b/packages/wct-runner/testResources/jsTestSuite/wct.conf.json index b1782f904e..ca700ee90d 100644 --- a/packages/wct-runner/testResources/jsTestSuite/wct.conf.json +++ b/packages/wct-runner/testResources/jsTestSuite/wct.conf.json @@ -1,6 +1,6 @@ { "verbose": true, - "suites": ["packages/wct-runner/testResources/jsTestSuite/test"], + "suites": ["testResources/jsTestSuite/test"], "plugins": { "local": { "browsers": ["chrome"], @@ -12,5 +12,5 @@ } }, "npm": true, - "root": "../../../../.." + "root": "../../.." } \ No newline at end of file diff --git a/packages/webpack-transpiler/.vscode/launch.json b/packages/webpack-transpiler/.vscode/launch.json index a949b9d86f..570048043d 100644 --- a/packages/webpack-transpiler/.vscode/launch.json +++ b/packages/webpack-transpiler/.vscode/launch.json @@ -10,8 +10,6 @@ "name": "Unit tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors", @@ -30,8 +28,6 @@ "name": "Integration tests", "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", "args": [ - "-u", - "tdd", "--timeout", "999999", "--colors",