Skip to content

Fix various issues related to functional tests #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ matrix:
- name: 'Lowest versions of the dependencies'
os: linux
node_js: "10"
env: JOB_PART=test
env:
- JOB_PART=test
- DISABLE_UNSTABLE_CHECKS=1
install:
- rm yarn.lock
- node ./scripts/force-lowest-dependencies
- yarn
- name: 'Highest versions of the dependencies'
os: linux
node_js: "10"
env: JOB_PART=test
env:
- JOB_PART=test
- DISABLE_UNSTABLE_CHECKS=1
install:
- rm yarn.lock
- yarn
Expand Down
5 changes: 3 additions & 2 deletions fixtures/vuejs-typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"target": "es6",
"strict": true,
"module": "es2015",
"moduleResolution": "node"
"moduleResolution": "node",
"allowSyntheticDefaultImports": true
},
"include": [
"./**/*.ts",
"./**/*.ts"
]
}
2 changes: 1 addition & 1 deletion test/bin/encore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const exec = require('child_process').exec;

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

it('Basic smoke test', (done) => {
testSetup.emptyTmpDir();
Expand Down
78 changes: 42 additions & 36 deletions test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function getEntrypointData(config, entryName) {

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

before(() => {
testSetup.emptyTmpDir();
Expand Down Expand Up @@ -388,14 +388,16 @@ describe('Functional tests using webpack', function() {
config.enableVersioning(true);

testSetup.runWebpack(config, (webpackAssert) => {
expect(config.outputPath).to.be.a.directory()
.with.files([
'main.89eb104b.js',
'styles.8ec31654.css',
'manifest.json',
'entrypoints.json',
'runtime.3d179b24.js',
]);
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
expect(config.outputPath).to.be.a.directory()
.with.files([
'main.89eb104b.js',
'styles.8ec31654.css',
'manifest.json',
'entrypoints.json',
'runtime.3d179b24.js',
]);
}

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

testSetup.runWebpack(config, (webpackAssert) => {
expect(config.outputPath).to.be.a.directory()
.with.files([
'0.590a68c7.js', // chunks are also versioned
'0.8ec31654.css',
'main.4a5effdb.js',
'h1.8ec31654.css',
'bg.0ec2735b.css',
'manifest.json',
'entrypoints.json',
'runtime.b84a9b43.js',
]);
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
expect(config.outputPath).to.be.a.directory()
.with.files([
'0.590a68c7.js', // chunks are also versioned
'0.8ec31654.css',
'main.4a5effdb.js',
'h1.8ec31654.css',
'bg.0ec2735b.css',
'manifest.json',
'entrypoints.json',
'runtime.b84a9b43.js',
]);
}

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

it('TypeScript is compiled and type checking is done in a separate process!', (done) => {
this.timeout(8000);
setTimeout(done, 7000);
this.timeout(10000);
setTimeout(done, 9000);

const config = createWebpackConfig('www/build', 'dev');
config.setPublicPath('/build');
Expand Down Expand Up @@ -1687,26 +1691,28 @@ module.exports = {
}]);

testSetup.runWebpack(config, (webpackAssert) => {
expect(config.outputPath).to.be.a.directory()
.with.files([
'entrypoints.json',
'runtime.6cf710cd.js',
'main.d85842cc.js',
'manifest.json',
'symfony_logo.ea1ca6f7.png',
'symfony_logo_alt.f27119c2.png',
]);
if (!process.env.DISABLE_UNSTABLE_CHECKS) {
expect(config.outputPath).to.be.a.directory()
.with.files([
'entrypoints.json',
'runtime.6cf710cd.js',
'main.d85842cc.js',
'manifest.json',
'symfony_logo.ea1ca6f7.png',
'symfony_logo_alt.f27119c2.png',
]);

webpackAssert.assertManifestPath(
'build/main.js',
'/build/main.d85842cc.js'
);
}

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

webpackAssert.assertManifestPath(
'build/main.js',
'/build/main.d85842cc.js'
);

webpackAssert.assertManifestPath(
'build/symfony_logo.png',
'/build/symfony_logo.ea1ca6f7.png'
Expand Down
4 changes: 2 additions & 2 deletions test/helpers/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ function runWebpack(webpackConfig, callback, allowCompilationError = false) {

const compiler = webpack(configGenerator(webpackConfig));
compiler.run((err, stats) => {
// Restore stdout
process.stdout.write = stdoutWrite;

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

// Restore stdout and then call the callback
process.stdout.write = stdoutWrite;
callback(assertUtil(webpackConfig), stats, stdOutContents.join('\n'));
});
} catch (e) {
Expand Down