Skip to content

Commit 244141c

Browse files
Ryan WeaverRyan Weaver
Ryan Weaver
authored and
Ryan Weaver
committed
minor #501 Fix various issues related to functional tests (Lyrkan)
This PR was merged into the master branch. Discussion ---------- Fix various issues related to functional tests This PR fixes various things that currently make the tests result indicators quite unreliable: * Set a `DISABLE_UNSTABLE_CHECKS` environment variable and use it to disable some checks related to filenames with hashes that are subject to frequent changes (for instance `runtime.xxxxxxxx.js` when updating Webpack). This only applies to "Lowest versions of the dependencies" and "Highest versions of the dependencies" jobs. * Fix the Vue.js + Typescript test that was silently failing in the "Lowest versions of the dependencies" job (no idea why it worked for the other ones...) * Increase default timeouts of functional tests from 8s to 10s (since they were frequently failing because of that) * Restore the standard output at the beginning of the compiler callback in `runWebpack()` (doing it later could end up hiding the rest of the job's output if an exception was thrown) Commits ------- b007c0e Fix various issues related to functional tests
2 parents 02ff319 + b007c0e commit 244141c

File tree

5 files changed

+54
-43
lines changed

5 files changed

+54
-43
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ matrix:
1111
- name: 'Lowest versions of the dependencies'
1212
os: linux
1313
node_js: "10"
14-
env: JOB_PART=test
14+
env:
15+
- JOB_PART=test
16+
- DISABLE_UNSTABLE_CHECKS=1
1517
install:
1618
- rm yarn.lock
1719
- node ./scripts/force-lowest-dependencies
1820
- yarn
1921
- name: 'Highest versions of the dependencies'
2022
os: linux
2123
node_js: "10"
22-
env: JOB_PART=test
24+
env:
25+
- JOB_PART=test
26+
- DISABLE_UNSTABLE_CHECKS=1
2327
install:
2428
- rm yarn.lock
2529
- yarn

fixtures/vuejs-typescript/tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"target": "es6",
44
"strict": true,
55
"module": "es2015",
6-
"moduleResolution": "node"
6+
"moduleResolution": "node",
7+
"allowSyntheticDefaultImports": true
78
},
89
"include": [
9-
"./**/*.ts",
10+
"./**/*.ts"
1011
]
1112
}

test/bin/encore.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const exec = require('child_process').exec;
1919

2020
describe('bin/encore.js', function() {
2121
// being functional tests, these can take quite long
22-
this.timeout(8000);
22+
this.timeout(10000);
2323

2424
it('Basic smoke test', (done) => {
2525
testSetup.emptyTmpDir();

test/functional.js

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function getEntrypointData(config, entryName) {
6262

6363
describe('Functional tests using webpack', function() {
6464
// being functional tests, these can take quite long
65-
this.timeout(8000);
65+
this.timeout(10000);
6666

6767
before(() => {
6868
testSetup.emptyTmpDir();
@@ -388,14 +388,16 @@ describe('Functional tests using webpack', function() {
388388
config.enableVersioning(true);
389389

390390
testSetup.runWebpack(config, (webpackAssert) => {
391-
expect(config.outputPath).to.be.a.directory()
392-
.with.files([
393-
'main.89eb104b.js',
394-
'styles.8ec31654.css',
395-
'manifest.json',
396-
'entrypoints.json',
397-
'runtime.3d179b24.js',
398-
]);
391+
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
392+
expect(config.outputPath).to.be.a.directory()
393+
.with.files([
394+
'main.89eb104b.js',
395+
'styles.8ec31654.css',
396+
'manifest.json',
397+
'entrypoints.json',
398+
'runtime.3d179b24.js',
399+
]);
400+
}
399401

400402
webpackAssert.assertOutputFileContains(
401403
'styles.8ec31654.css',
@@ -489,17 +491,19 @@ describe('Functional tests using webpack', function() {
489491
config.enableVersioning(true);
490492

491493
testSetup.runWebpack(config, (webpackAssert) => {
492-
expect(config.outputPath).to.be.a.directory()
493-
.with.files([
494-
'0.590a68c7.js', // chunks are also versioned
495-
'0.8ec31654.css',
496-
'main.4a5effdb.js',
497-
'h1.8ec31654.css',
498-
'bg.0ec2735b.css',
499-
'manifest.json',
500-
'entrypoints.json',
501-
'runtime.b84a9b43.js',
502-
]);
494+
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
495+
expect(config.outputPath).to.be.a.directory()
496+
.with.files([
497+
'0.590a68c7.js', // chunks are also versioned
498+
'0.8ec31654.css',
499+
'main.4a5effdb.js',
500+
'h1.8ec31654.css',
501+
'bg.0ec2735b.css',
502+
'manifest.json',
503+
'entrypoints.json',
504+
'runtime.b84a9b43.js',
505+
]);
506+
}
503507

504508
expect(path.join(config.outputPath, 'images')).to.be.a.directory()
505509
.with.files([
@@ -1159,8 +1163,8 @@ module.exports = {
11591163
});
11601164

11611165
it('TypeScript is compiled and type checking is done in a separate process!', (done) => {
1162-
this.timeout(8000);
1163-
setTimeout(done, 7000);
1166+
this.timeout(10000);
1167+
setTimeout(done, 9000);
11641168

11651169
const config = createWebpackConfig('www/build', 'dev');
11661170
config.setPublicPath('/build');
@@ -1687,26 +1691,28 @@ module.exports = {
16871691
}]);
16881692

16891693
testSetup.runWebpack(config, (webpackAssert) => {
1690-
expect(config.outputPath).to.be.a.directory()
1691-
.with.files([
1692-
'entrypoints.json',
1693-
'runtime.6cf710cd.js',
1694-
'main.d85842cc.js',
1695-
'manifest.json',
1696-
'symfony_logo.ea1ca6f7.png',
1697-
'symfony_logo_alt.f27119c2.png',
1698-
]);
1694+
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
1695+
expect(config.outputPath).to.be.a.directory()
1696+
.with.files([
1697+
'entrypoints.json',
1698+
'runtime.6cf710cd.js',
1699+
'main.d85842cc.js',
1700+
'manifest.json',
1701+
'symfony_logo.ea1ca6f7.png',
1702+
'symfony_logo_alt.f27119c2.png',
1703+
]);
1704+
1705+
webpackAssert.assertManifestPath(
1706+
'build/main.js',
1707+
'/build/main.d85842cc.js'
1708+
);
1709+
}
16991710

17001711
expect(path.join(config.outputPath, 'assets')).to.be.a.directory()
17011712
.with.files([
17021713
'Roboto.woff2',
17031714
]);
17041715

1705-
webpackAssert.assertManifestPath(
1706-
'build/main.js',
1707-
'/build/main.d85842cc.js'
1708-
);
1709-
17101716
webpackAssert.assertManifestPath(
17111717
'build/symfony_logo.png',
17121718
'/build/symfony_logo.ea1ca6f7.png'

test/helpers/setup.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ function runWebpack(webpackConfig, callback, allowCompilationError = false) {
7373

7474
const compiler = webpack(configGenerator(webpackConfig));
7575
compiler.run((err, stats) => {
76+
// Restore stdout
77+
process.stdout.write = stdoutWrite;
7678

7779
if (err) {
7880
console.error(err.stack || err);
@@ -95,8 +97,6 @@ function runWebpack(webpackConfig, callback, allowCompilationError = false) {
9597
console.warn(info.warnings);
9698
}
9799

98-
// Restore stdout and then call the callback
99-
process.stdout.write = stdoutWrite;
100100
callback(assertUtil(webpackConfig), stats, stdOutContents.join('\n'));
101101
});
102102
} catch (e) {

0 commit comments

Comments
 (0)