Removed test formatting, more trouble than it's worth
@@ -30,11 +30,11 @@ const path = require('path');
const TEST_FILES = glob.sync(path.resolve(
__dirname,
- '../../test/com/google/javascript/jscomp/runtime_tests/**/build/*_test.html'
+ '../../test/com/google/javascript/jscomp/runtime_tests/**/build/*_test.html',
));
describe('Runtime tests', () => {
- for (let testUrl of TEST_FILES) {
+ for (const testUrl of TEST_FILES) {
const logs = [];
const passed = /PASSED/i;
const failed = /FAILED/i;
@@ -46,13 +46,12 @@ describe('Runtime tests', () => {
if (isPass || isFail) {
return msg.replace(
- passed, chalk.green('PASSED')
+ passed, chalk.green('PASSED'),
).replace(
- failed, chalk.red('FAILED')
+ failed, chalk.red('FAILED'),
);
- }
- else return msg;
- }
+ } else return msg;
+ };
const testName = path.basename(testUrl);
const TestIsFinished = new FutureEvent();
@@ -67,13 +66,13 @@ describe('Runtime tests', () => {
path.resolve(
__dirname,
'../../',
- testUrl
+ testUrl,
),
- 'utf-8'
+ 'utf-8',
);
it(`should pass test suite ${path.basename(testUrl)}`, async () => {
- const { window } = new JSDOM(TEST_DOC, {
+ new JSDOM(TEST_DOC, {
/**
* This does not actually run a server of any kind, it only informs the
* DOM what to put in `window.location.origin`. By default, this is
@@ -90,21 +89,13 @@ describe('Runtime tests', () => {
/**
* Pipe `console.log` to our virtual console.
*/
- virtualConsole
+ virtualConsole,
});
try {
await TestIsFinished;
} catch (e) {
- // Format the error a bit: first line red, rest unformatted.
- const errorLines = e.toString().split('\n');
- let formattedError;
- for (let i = 0; i < errorLines.length; i++) {
- formattedError += i === 0
- ? chalk.red(errorLines[i])
- : errorLines[i];
- }
- fail(`Failed test in suite ${testName}: \n${formattedError}\n`);
+ fail(`Failed test in suite ${testName}: \n${e}\n`);
}
console.log(`Passed all tests in suite ${testName}`);
});
