1
1
/**
2
- * @license Apache-2.0
2
+ * @license MIT
3
+ *
3
4
* Copyright 2020 The Closure Compiler Authors.
4
5
*
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
6
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7
+ * use this file except in compliance with the License. You may obtain a copy of
8
+ * the License at
8
9
*
9
10
* http://www.apache.org/licenses/LICENSE-2.0
10
11
*
11
12
* Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
13
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ * License for the specific language governing permissions and limitations under
16
+ * the License.
16
17
*/
17
18
/**
18
19
* @fileoverview
19
- * Crawl over all test/com/google/.../runtime_tests/ *_test.html files and
20
- * execute them in a JSDOM context, fail the test if any do not succeed.
20
+ * Crawl over all ../ *_test.html files and execute them in a JSDOM context,
21
+ * fail the test if any do not succeed.
21
22
*/
22
23
23
24
const { JSDOM , VirtualConsole } = require ( 'jsdom' ) ;
@@ -32,11 +33,7 @@ const path = require('path');
32
33
* All test files in the test.com.google.javascript.jscomp.runtime_tests.build
33
34
* directory.
34
35
*/
35
- const TEST_FILES = glob . sync ( path . resolve (
36
- __dirname ,
37
- '../../test/com/google/javascript/jscomp/'
38
- + 'runtime_tests/**/build/*_test.html' ,
39
- ) ) ;
36
+ const TEST_FILES = glob . sync ( '../**/build/*_test.html' ) ;
40
37
41
38
/**
42
39
* Iterate over all found test files and execute them in JSDOM.
@@ -58,11 +55,11 @@ describe('Runtime tests', () => {
58
55
/**
59
56
* Highlight PASSED and FAILED in messages to help with accessibility.
60
57
*/
61
- return ( isPass || isFail )
62
- ? msg
58
+ return ( isPass || isFail ) ?
59
+ msg
63
60
. replace ( passed , chalk . green ( 'PASSED' ) )
64
- . replace ( failed , chalk . red ( 'FAILED' ) )
65
- : msg ;
61
+ . replace ( failed , chalk . red ( 'FAILED' ) ) :
62
+ msg ;
66
63
} ;
67
64
68
65
/**
@@ -91,11 +88,7 @@ describe('Runtime tests', () => {
91
88
* This will be a raw HTML document.
92
89
*/
93
90
const testDocument = fs . readFileSync (
94
- path . resolve (
95
- __dirname ,
96
- '../../' ,
97
- testFile ,
98
- ) ,
91
+ path . resolve ( testFile ) ,
99
92
'utf-8' ,
100
93
) ;
101
94
0 commit comments