@brillout/test-e2e 0.3.12 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Logs.js +5 -1
- package/dist/cli.js +2 -2
- package/dist/findTestFiles.js +7 -14
- package/dist/github-action.d.ts +4 -0
- package/dist/github-action.js +30 -0
- package/dist/logSection.d.ts +2 -0
- package/dist/logSection.js +14 -0
- package/dist/runTests.d.ts +2 -2
- package/dist/runTests.js +101 -49
- package/dist/setup.d.ts +2 -2
- package/dist/setup.js +9 -6
- package/dist/utils/platform.d.ts +2 -2
- package/dist/utils/platform.js +3 -3
- package/dist/utils/runCommand.js +2 -2
- package/package.json +1 -1
- package/dist/runTestSuites.d.ts +0 -3
- package/dist/runTestSuites.js +0 -32
package/dist/Logs.js
CHANGED
|
@@ -16,6 +16,7 @@ const utils_1 = require("./utils");
|
|
|
16
16
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
17
17
|
const getCurrentTest_1 = require("./getCurrentTest");
|
|
18
18
|
const getConfig_1 = require("./getConfig");
|
|
19
|
+
const logSection_1 = require("./logSection");
|
|
19
20
|
let logEntries = [];
|
|
20
21
|
function hasErrorLogs(failOnWarning) {
|
|
21
22
|
const errorLogs = getErrorLogs(failOnWarning);
|
|
@@ -43,11 +44,14 @@ function clearLogs() {
|
|
|
43
44
|
logEntries = [];
|
|
44
45
|
}
|
|
45
46
|
function logErrors(failOnWarning) {
|
|
47
|
+
if (!exports.Logs.hasErrorLogs(failOnWarning))
|
|
48
|
+
return;
|
|
49
|
+
(0, logSection_1.logSection)(`ERROR${!failOnWarning ? '' : '/WARNING'} LOGS`);
|
|
46
50
|
const errorLogs = getErrorLogs(failOnWarning);
|
|
47
51
|
errorLogs.forEach((logEntry) => printLog(logEntry));
|
|
48
52
|
}
|
|
49
53
|
function flushLogs() {
|
|
50
|
-
|
|
54
|
+
(0, logSection_1.logSection)('ALL LOGS');
|
|
51
55
|
logEntries.forEach((logEntry) => printLog(logEntry));
|
|
52
56
|
logEntries = [];
|
|
53
57
|
}
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const source_map_support_1 = __importDefault(require("source-map-support"));
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
-
const
|
|
8
|
+
const runTests_1 = require("./runTests");
|
|
9
9
|
const buildTs_1 = require("./buildTs");
|
|
10
10
|
const Logs_1 = require("./Logs");
|
|
11
11
|
initSourceMap();
|
|
@@ -14,7 +14,7 @@ initUserExitHandler();
|
|
|
14
14
|
cli();
|
|
15
15
|
function cli() {
|
|
16
16
|
const filter = (0, utils_1.findFilesParseCliArgs)();
|
|
17
|
-
(0,
|
|
17
|
+
(0, runTests_1.runTests)(filter);
|
|
18
18
|
}
|
|
19
19
|
function initPromiseRejectionHandler() {
|
|
20
20
|
process.on('unhandledRejection', function (err) {
|
package/dist/findTestFiles.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.findTestFiles = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
4
|
const utils_1 = require("./utils");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
// Unit tests `**/*.spec.*` are handled by Vitesse
|
|
5
|
+
const github_action_1 = require("./github-action");
|
|
6
|
+
// Unit tests `**/*.spec.*` are handled by Vitest
|
|
12
7
|
const testFilenamePattern = '**/*.test.ts';
|
|
13
8
|
async function findTestFiles(findFilter) {
|
|
14
|
-
|
|
15
|
-
const testFiles =
|
|
16
|
-
testFiles
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
return testFiles;
|
|
9
|
+
{
|
|
10
|
+
const testFiles = (0, github_action_1.getTestFiles)();
|
|
11
|
+
if (testFiles)
|
|
12
|
+
return testFiles;
|
|
20
13
|
}
|
|
21
|
-
|
|
14
|
+
{
|
|
22
15
|
const testFiles = (0, utils_1.findFiles)(testFilenamePattern, findFilter);
|
|
23
16
|
return testFiles;
|
|
24
17
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getTestFiles = exports.abortIfGitHubAction = void 0;
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const cwd = process.cwd();
|
|
11
|
+
function abortIfGitHubAction() {
|
|
12
|
+
if (isGitHubAction()) {
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.abortIfGitHubAction = abortIfGitHubAction;
|
|
17
|
+
function isGitHubAction() {
|
|
18
|
+
return getTestFiles() !== null;
|
|
19
|
+
}
|
|
20
|
+
function getTestFiles() {
|
|
21
|
+
if (!('TEST_FILES' in process.env))
|
|
22
|
+
return null;
|
|
23
|
+
(0, utils_1.assert)(process.env.TEST_FILES);
|
|
24
|
+
const testFiles = process.env.TEST_FILES.split(' ').map((filePathRelative) => path_1.default.join(cwd, filePathRelative));
|
|
25
|
+
testFiles.forEach((testFile) => {
|
|
26
|
+
(0, utils_1.assert)(fs_1.default.existsSync(testFile), testFile);
|
|
27
|
+
});
|
|
28
|
+
return testFiles;
|
|
29
|
+
}
|
|
30
|
+
exports.getTestFiles = getTestFiles;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.logSection = void 0;
|
|
7
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
8
|
+
function logSection(sectionTitle) {
|
|
9
|
+
console.log();
|
|
10
|
+
console.log();
|
|
11
|
+
console.log();
|
|
12
|
+
console.log(picocolors_1.default.bold(`vvvvvv ${sectionTitle} vvvvvv`));
|
|
13
|
+
}
|
|
14
|
+
exports.logSection = logSection;
|
package/dist/runTests.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { runTests };
|
|
2
|
-
import type
|
|
3
|
-
declare function runTests(
|
|
2
|
+
import { type FindFilter } from './utils';
|
|
3
|
+
declare function runTests(filter: null | FindFilter): Promise<void>;
|
package/dist/runTests.js
CHANGED
|
@@ -7,8 +7,38 @@ exports.runTests = void 0;
|
|
|
7
7
|
const getCurrentTest_1 = require("./getCurrentTest");
|
|
8
8
|
const Logs_1 = require("./Logs");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
|
+
const utils_2 = require("./utils");
|
|
10
11
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
11
|
-
|
|
12
|
+
const github_action_1 = require("./github-action");
|
|
13
|
+
const logSection_1 = require("./logSection");
|
|
14
|
+
const getCurrentTest_2 = require("./getCurrentTest");
|
|
15
|
+
const getBrowser_1 = require("./getBrowser");
|
|
16
|
+
const buildTs_1 = require("./buildTs");
|
|
17
|
+
const findTestFiles_1 = require("./findTestFiles");
|
|
18
|
+
const getConfig_1 = require("./getConfig");
|
|
19
|
+
async function runTests(filter) {
|
|
20
|
+
await (0, getConfig_1.loadConfig)();
|
|
21
|
+
const testFiles = await (0, findTestFiles_1.findTestFiles)(filter);
|
|
22
|
+
const browser = await (0, getBrowser_1.getBrowser)();
|
|
23
|
+
for (const testFile of testFiles) {
|
|
24
|
+
(0, utils_1.assert)(testFile.endsWith('.ts'));
|
|
25
|
+
const testFileJs = testFile.replace('.ts', '.mjs');
|
|
26
|
+
const clean = await (0, buildTs_1.buildTs)(testFile, testFileJs);
|
|
27
|
+
(0, getCurrentTest_2.setCurrentTest)(testFile);
|
|
28
|
+
try {
|
|
29
|
+
await import((0, utils_2.fsWindowsBugWorkaround)(testFileJs));
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
clean();
|
|
33
|
+
}
|
|
34
|
+
await runTestFile(browser);
|
|
35
|
+
(0, getCurrentTest_2.setCurrentTest)(null);
|
|
36
|
+
(0, utils_1.assert)(testFileJs.endsWith('.mjs'));
|
|
37
|
+
}
|
|
38
|
+
await browser.close();
|
|
39
|
+
}
|
|
40
|
+
exports.runTests = runTests;
|
|
41
|
+
async function runTestFile(browser) {
|
|
12
42
|
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
|
13
43
|
if (utils_1.isTTY) {
|
|
14
44
|
console.log();
|
|
@@ -18,7 +48,7 @@ async function runTests(browser) {
|
|
|
18
48
|
testInfo.page = page;
|
|
19
49
|
// Set when user calls `skip()`
|
|
20
50
|
if (testInfo.skipped) {
|
|
21
|
-
|
|
51
|
+
logResult(false);
|
|
22
52
|
(0, utils_1.assertUsage)(!testInfo.runInfo, 'You cannot call `run()` after calling `skip()`');
|
|
23
53
|
(0, utils_1.assertUsage)(testInfo.tests === undefined, 'You cannot call `test()` after calling `skip()`');
|
|
24
54
|
return;
|
|
@@ -30,15 +60,25 @@ async function runTests(browser) {
|
|
|
30
60
|
(0, utils_1.assert)(testInfo.afterEach);
|
|
31
61
|
// Set when user calls `test()`
|
|
32
62
|
(0, utils_1.assert)(testInfo.tests);
|
|
63
|
+
const clean = async () => {
|
|
64
|
+
await testInfo.terminateServer?.();
|
|
65
|
+
await page.close();
|
|
66
|
+
};
|
|
67
|
+
const abort = async () => {
|
|
68
|
+
await clean();
|
|
69
|
+
(0, github_action_1.abortIfGitHubAction)();
|
|
70
|
+
};
|
|
33
71
|
// TODO: resolve a success flag instead rejecting
|
|
34
72
|
try {
|
|
35
73
|
await testInfo.startServer();
|
|
36
74
|
}
|
|
37
75
|
catch (err) {
|
|
38
|
-
|
|
39
|
-
|
|
76
|
+
logResult(false);
|
|
77
|
+
logFailureReason('an error occurred while starting the server');
|
|
78
|
+
logError(err);
|
|
40
79
|
Logs_1.Logs.flushLogs();
|
|
41
|
-
|
|
80
|
+
await abort();
|
|
81
|
+
return;
|
|
42
82
|
}
|
|
43
83
|
for (const { testDesc, testFn } of testInfo.tests) {
|
|
44
84
|
Logs_1.Logs.add({
|
|
@@ -55,41 +95,48 @@ async function runTests(browser) {
|
|
|
55
95
|
}
|
|
56
96
|
done(!!err);
|
|
57
97
|
testInfo.afterEach(!!err);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
98
|
+
{
|
|
99
|
+
const failOnWarning = !testInfo.runInfo.doNotFailOnWarning;
|
|
100
|
+
const hasErrorLog = Logs_1.Logs.hasErrorLogs(failOnWarning);
|
|
101
|
+
const isFailure = err || hasErrorLog;
|
|
102
|
+
if (isFailure) {
|
|
103
|
+
logResult(false);
|
|
104
|
+
if (err) {
|
|
105
|
+
logFailureReason(`the test "${testDesc}" threw an error`);
|
|
106
|
+
logError(err);
|
|
107
|
+
}
|
|
108
|
+
else if (hasErrorLog) {
|
|
109
|
+
logFailureReason(`${getErrorType(failOnWarning)} occurred while running the test "${testDesc}"`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
(0, utils_1.assert)(false);
|
|
113
|
+
}
|
|
114
|
+
Logs_1.Logs.logErrors(failOnWarning);
|
|
115
|
+
Logs_1.Logs.flushLogs();
|
|
116
|
+
await abort();
|
|
117
|
+
return;
|
|
68
118
|
}
|
|
69
|
-
Logs_1.Logs.flushLogs();
|
|
70
|
-
process.exit(1);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
Logs_1.Logs.clearLogs();
|
|
74
119
|
}
|
|
120
|
+
Logs_1.Logs.clearLogs();
|
|
75
121
|
}
|
|
76
|
-
await
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
Logs_1.Logs.
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
logIsFailure(true, false);
|
|
122
|
+
await clean();
|
|
123
|
+
// Check whether stderr emitted during testInfo.terminateServer()
|
|
124
|
+
{
|
|
125
|
+
const failOnWarning = true;
|
|
126
|
+
if (Logs_1.Logs.hasErrorLogs(failOnWarning)) {
|
|
127
|
+
logFailureReason(`${getErrorType(failOnWarning)} occurred during server termination`);
|
|
128
|
+
Logs_1.Logs.logErrors(failOnWarning);
|
|
86
129
|
Logs_1.Logs.flushLogs();
|
|
87
|
-
|
|
130
|
+
await abort();
|
|
131
|
+
return;
|
|
88
132
|
}
|
|
89
133
|
}
|
|
90
|
-
|
|
134
|
+
Logs_1.Logs.clearLogs();
|
|
135
|
+
logResult(true);
|
|
136
|
+
}
|
|
137
|
+
function getErrorType(failOnWarning) {
|
|
138
|
+
return !failOnWarning ? 'error(s)' : 'error(s)/warning(s)';
|
|
91
139
|
}
|
|
92
|
-
exports.runTests = runTests;
|
|
93
140
|
function runTest(testFn, testFunctionTimeout) {
|
|
94
141
|
let resolve;
|
|
95
142
|
let reject;
|
|
@@ -115,30 +162,35 @@ function runTest(testFn, testFunctionTimeout) {
|
|
|
115
162
|
})();
|
|
116
163
|
return promise;
|
|
117
164
|
}
|
|
118
|
-
function
|
|
165
|
+
function logResult(success) {
|
|
119
166
|
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
|
120
|
-
const
|
|
121
|
-
const failStyle = (t) => picocolors_1.default.bold(picocolors_1.default.bgRed(t));
|
|
122
|
-
const skipStyle = (t) => picocolors_1.default.bold(picocolors_1.default.bgYellow(t));
|
|
167
|
+
const { PASS, FAIL, WARN } = getStatusTags();
|
|
123
168
|
if (success) {
|
|
124
169
|
(0, utils_1.assert)(!testInfo.skipped);
|
|
125
|
-
console.log(`${
|
|
170
|
+
console.log(`${PASS} ${testInfo.testFile}`);
|
|
126
171
|
return;
|
|
127
172
|
}
|
|
128
173
|
if (testInfo.skipped) {
|
|
129
|
-
console.log(`${
|
|
174
|
+
console.log(`${WARN} ${testInfo.testFile} (${testInfo.skipped})`);
|
|
130
175
|
}
|
|
131
176
|
else {
|
|
132
|
-
console.log(`${
|
|
177
|
+
console.log(`${FAIL} ${testInfo.testFile}`);
|
|
133
178
|
}
|
|
134
179
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
180
|
+
function logFailureReason(reason) {
|
|
181
|
+
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
|
182
|
+
const { FAIL } = getStatusTags();
|
|
183
|
+
const color = (s) => picocolors_1.default.red(picocolors_1.default.bold(s));
|
|
184
|
+
const msg = `Test ${testInfo.testFile} ${FAIL} because ${reason}, see below.`;
|
|
185
|
+
console.log(color(msg));
|
|
186
|
+
}
|
|
187
|
+
function logError(err) {
|
|
188
|
+
(0, logSection_1.logSection)('ERROR');
|
|
189
|
+
console.log(err);
|
|
190
|
+
}
|
|
191
|
+
function getStatusTags() {
|
|
192
|
+
const PASS = picocolors_1.default.bold(picocolors_1.default.bgGreen(picocolors_1.default.white(' PASS ')));
|
|
193
|
+
const FAIL = picocolors_1.default.bold(picocolors_1.default.bgRed(picocolors_1.default.white(' FAIL ')));
|
|
194
|
+
const WARN = picocolors_1.default.bold(picocolors_1.default.bgYellow(picocolors_1.default.white(' WARN ')));
|
|
195
|
+
return { PASS, FAIL, WARN };
|
|
144
196
|
}
|
package/dist/setup.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sleep, isWindows, isLinux,
|
|
1
|
+
import { sleep, isWindows, isLinux, isCI, isMac } from './utils';
|
|
2
2
|
import fetch_ from 'node-fetch';
|
|
3
3
|
export { partRegex } from '@brillout/part-regex';
|
|
4
4
|
export { autoRetry };
|
|
@@ -8,7 +8,7 @@ export { expectError } from './Logs';
|
|
|
8
8
|
export { run };
|
|
9
9
|
export { skip };
|
|
10
10
|
export { isMinNodeVersion };
|
|
11
|
-
export {
|
|
11
|
+
export { isCI };
|
|
12
12
|
export { isLinux };
|
|
13
13
|
export { isWindows };
|
|
14
14
|
export { isMac };
|
package/dist/setup.js
CHANGED
|
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getServerUrl = exports.sleep = exports.isMac = exports.isWindows = exports.isLinux = exports.
|
|
6
|
+
exports.getServerUrl = exports.sleep = exports.isMac = exports.isWindows = exports.isLinux = exports.isCI = exports.isMinNodeVersion = exports.skip = exports.run = exports.expectError = exports.fetch = exports.fetchHtml = exports.autoRetry = exports.partRegex = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
10
|
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return utils_1.sleep; } });
|
|
11
11
|
Object.defineProperty(exports, "isWindows", { enumerable: true, get: function () { return utils_1.isWindows; } });
|
|
12
12
|
Object.defineProperty(exports, "isLinux", { enumerable: true, get: function () { return utils_1.isLinux; } });
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "isCI", { enumerable: true, get: function () { return utils_1.isCI; } });
|
|
14
14
|
Object.defineProperty(exports, "isMac", { enumerable: true, get: function () { return utils_1.isMac; } });
|
|
15
15
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
16
16
|
const utils_2 = require("./utils");
|
|
@@ -24,9 +24,9 @@ Object.defineProperty(exports, "partRegex", { enumerable: true, get: function ()
|
|
|
24
24
|
var Logs_2 = require("./Logs");
|
|
25
25
|
Object.defineProperty(exports, "expectError", { enumerable: true, get: function () { return Logs_2.expectError; } });
|
|
26
26
|
const serverUrlDefault = 'http://localhost:3000';
|
|
27
|
-
const TIMEOUT_NPM_SCRIPT = 2 * 60 * 1000 * (!(0, utils_1.
|
|
28
|
-
const TIMEOUT_TEST_FUNCTION = 60 * 1000 * (!(0, utils_1.
|
|
29
|
-
const TIMEOUT_PROCESS_TERMINATION = 10 * 1000 * (!(0, utils_1.
|
|
27
|
+
const TIMEOUT_NPM_SCRIPT = 2 * 60 * 1000 * (!(0, utils_1.isCI)() ? 1 : (0, utils_1.isWindows)() ? 2 : 1);
|
|
28
|
+
const TIMEOUT_TEST_FUNCTION = 60 * 1000 * (!(0, utils_1.isCI)() ? 1 : (0, utils_1.isWindows)() ? 5 : 3);
|
|
29
|
+
const TIMEOUT_PROCESS_TERMINATION = 10 * 1000 * (!(0, utils_1.isCI)() ? 1 : (0, utils_1.isWindows)() ? 10 : !(0, utils_1.isLinux)() ? 3 : 1);
|
|
30
30
|
const TIMEOUT_AUTORETRY = TIMEOUT_TEST_FUNCTION / 2;
|
|
31
31
|
const TIMEOUT_PLAYWRIGHT = TIMEOUT_TEST_FUNCTION / 2;
|
|
32
32
|
function skip(reason) {
|
|
@@ -357,7 +357,10 @@ function execRunScript({ onStdout, onFailure, onExit, }) {
|
|
|
357
357
|
logSource: 'run() failure',
|
|
358
358
|
logText: errMsg,
|
|
359
359
|
});
|
|
360
|
-
|
|
360
|
+
/* Don't interrupt the test runner, as the test runner may recover thanks to the process-killing-by-port
|
|
361
|
+
reject(new Error(errMsg))
|
|
362
|
+
*/
|
|
363
|
+
resolve();
|
|
361
364
|
}, TIMEOUT_PROCESS_TERMINATION);
|
|
362
365
|
(0, utils_2.assert)(proc);
|
|
363
366
|
try {
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { isCI };
|
|
2
2
|
export { isLinux };
|
|
3
3
|
export { isWindows };
|
|
4
4
|
export { isMac };
|
|
5
5
|
declare function isWindows(): boolean;
|
|
6
6
|
declare function isLinux(): boolean;
|
|
7
7
|
declare function isMac(): boolean;
|
|
8
|
-
declare function
|
|
8
|
+
declare function isCI(): boolean;
|
package/dist/utils/platform.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMac = exports.isWindows = exports.isLinux = exports.
|
|
3
|
+
exports.isMac = exports.isWindows = exports.isLinux = exports.isCI = void 0;
|
|
4
4
|
const assert_1 = require("./assert");
|
|
5
5
|
function isWindows() {
|
|
6
6
|
return process.platform === 'win32';
|
|
@@ -18,7 +18,7 @@ function isMac() {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
exports.isMac = isMac;
|
|
21
|
-
function
|
|
21
|
+
function isCI() {
|
|
22
22
|
return !!process.env.CI;
|
|
23
23
|
}
|
|
24
|
-
exports.
|
|
24
|
+
exports.isCI = isCI;
|
package/dist/utils/runCommand.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.runCommand = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
function runCommand(cmd, { swallowError = false, timeout = 5000, cwd = process.cwd(), } = {}) {
|
|
6
|
-
const { promise, resolvePromise } = genPromise();
|
|
6
|
+
const { promise, resolvePromise, rejectPromise } = genPromise();
|
|
7
7
|
const t = setTimeout(() => {
|
|
8
8
|
console.error(`Command call \`${cmd}\` timeout [${timeout / 1000} seconds][${cwd}].`);
|
|
9
|
-
|
|
9
|
+
rejectPromise();
|
|
10
10
|
}, timeout);
|
|
11
11
|
const options = { cwd };
|
|
12
12
|
(0, child_process_1.exec)(cmd, options, (err, stdout, stderr) => {
|
package/package.json
CHANGED
package/dist/runTestSuites.d.ts
DELETED
package/dist/runTestSuites.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runTestSuites = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
const getCurrentTest_1 = require("./getCurrentTest");
|
|
6
|
-
const runTests_1 = require("./runTests");
|
|
7
|
-
const getBrowser_1 = require("./getBrowser");
|
|
8
|
-
const buildTs_1 = require("./buildTs");
|
|
9
|
-
const findTestFiles_1 = require("./findTestFiles");
|
|
10
|
-
const getConfig_1 = require("./getConfig");
|
|
11
|
-
async function runTestSuites(filter) {
|
|
12
|
-
await (0, getConfig_1.loadConfig)();
|
|
13
|
-
const testFiles = await (0, findTestFiles_1.findTestFiles)(filter);
|
|
14
|
-
const browser = await (0, getBrowser_1.getBrowser)();
|
|
15
|
-
for (const testFile of testFiles) {
|
|
16
|
-
(0, utils_1.assert)(testFile.endsWith('.ts'));
|
|
17
|
-
const testFileJs = testFile.replace('.ts', '.mjs');
|
|
18
|
-
const clean = await (0, buildTs_1.buildTs)(testFile, testFileJs);
|
|
19
|
-
(0, getCurrentTest_1.setCurrentTest)(testFile);
|
|
20
|
-
try {
|
|
21
|
-
await import((0, utils_1.fsWindowsBugWorkaround)(testFileJs));
|
|
22
|
-
}
|
|
23
|
-
finally {
|
|
24
|
-
clean();
|
|
25
|
-
}
|
|
26
|
-
await (0, runTests_1.runTests)(browser);
|
|
27
|
-
(0, getCurrentTest_1.setCurrentTest)(null);
|
|
28
|
-
(0, utils_1.assert)(testFileJs.endsWith('.mjs'));
|
|
29
|
-
}
|
|
30
|
-
await browser.close();
|
|
31
|
-
}
|
|
32
|
-
exports.runTestSuites = runTestSuites;
|