Skip to content

fix(tests): e2e tests returns exit code 1 when failing #328

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
Mar 20, 2016
Merged
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
67 changes: 34 additions & 33 deletions tests/e2e/e2e_workflow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ describe('Basic end-to-end Workflow', function () {
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(process.cwd(), 'dist'))).to.be.equal(true);
}).catch((err) => {
throw new Error('Build failed.');
});
});

Expand All @@ -87,7 +89,8 @@ describe('Basic end-to-end Workflow', function () {

return ng(testArgs)
.then(function(result) {
expect(result.exitCode).to.be.equal(0);
const exitCode = typeof result === 'object' ? result.exitCode : result;
expect(exitCode).to.be.equal(0);
});
});

Expand All @@ -111,7 +114,8 @@ describe('Basic end-to-end Workflow', function () {

return ng(testArgs)
.then(function(result) {
expect(result.exitCode).to.be.equal(0);
const exitCode = typeof result === 'object' ? result.exitCode : result;
expect(exitCode).to.be.equal(0);
});
});

Expand All @@ -133,7 +137,8 @@ describe('Basic end-to-end Workflow', function () {

return ng(testArgs)
.then(function(result) {
expect(result.exitCode).to.be.equal(0);
const exitCode = typeof result === 'object' ? result.exitCode : result;
expect(exitCode).to.be.equal(0);
});
});

Expand All @@ -155,7 +160,8 @@ describe('Basic end-to-end Workflow', function () {

return ng(testArgs)
.then(function(result) {
expect(result.exitCode).to.be.equal(0);
const exitCode = typeof result === 'object' ? result.exitCode : result;
expect(exitCode).to.be.equal(0);
});
});

Expand Down Expand Up @@ -186,41 +192,36 @@ describe('Basic end-to-end Workflow', function () {

return ng(testArgs)
.then(function(result) {
expect(result.exitCode).to.be.equal(0);

// Clean `tmp` folder
// process.chdir(path.resolve(root, '..'));
// sh.rm('-rf', './tmp'); // tmp.teardown takes too long
const exitCode = typeof result === 'object' ? result.exitCode : result;
expect(exitCode).to.be.equal(0);
});
});

it('Turn on `noImplicitAny` in tsconfig.json and rebuild', function (done) {
this.timeout(420000);

var configFilePath = path.join(process.cwd(), 'src', 'tsconfig.json');
fs.readFile(configFilePath, 'utf8', function(err, data){

var config = JSON.parse(data);
config.compilerOptions.noImplicitAny = true;

fs.writeFile(configFilePath, JSON.stringify(config), function(){
//clear the dist folder
sh.rm('-rf', path.join(process.cwd(), 'dist'));

return ng([
'build',
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(process.cwd(), 'dist'))).to.be.equal(true);
})
.finally(function(){
// Clean `tmp` folder
process.chdir(path.resolve(root, '..'));
sh.rm('-rf', './tmp'); // tmp.teardown takes too long
done();
});
});
});
const configFilePath = path.join(process.cwd(), 'src', 'tsconfig.json');
let config = require(configFilePath);

config.compilerOptions.noImplicitAny = true;
fs.writeFileSync(configFilePath, JSON.stringify(config), 'utf8');

sh.rm('-rf', path.join(process.cwd(), 'dist'));

return ng([
'build',
'--silent'
]).then(function() {
expect(fs.existsSync(path.join(process.cwd(), 'dist'))).to.be.equal(true);
}).catch((err) => {
throw new Error('Build failed.');
})
.finally(function(){
// Clean `tmp` folder
process.chdir(path.resolve(root, '..'));
sh.rm('-rf', './tmp'); // tmp.teardown takes too long
done();
});
});

});