Skip to content

Commit

Permalink
fix: update addons-linter to version 0.26.1 and fix linting and funct…
Browse files Browse the repository at this point in the history
…ional tests (#1082)

* fix(package): update addons-linter to version 0.26.1(closes #1076)
* fix: Add eslint 3.19.0 in the web-ext devDependencies (fix eslint linting errors on addons-linter 0.26.1)
* fix: Run functional tests with production npm dependencies on CI
  • Loading branch information
kumar303 authored and rpl committed Sep 29, 2017
1 parent 177709b commit 0e51fb0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Expand Up @@ -11,7 +11,16 @@ before_script:

# Keep this in sync with appveyor.yml
script:
## run eslint, flow and the unit test suite.
- COVERAGE=y NODE_ENV=production npm test

## run functional test suite in a npm production environment
## (See #1082 for rationale).
- npm run copy-dist-files-to-artifacts-dir
- cd artifacts/production && npm install --production && cd -
- TEST_WEB_EXT_BIN=./artifacts/production/bin/web-ext npm run test:functional

## lint the github PR title.
- npm run travis-pr-title-lint

after_script: npm run publish-coverage
Expand Down
24 changes: 22 additions & 2 deletions Gruntfile.js
Expand Up @@ -30,13 +30,12 @@ module.exports = function(grunt) {
'webpack:functional_tests',
]);

grunt.registerTask('test', 'run linting and test suites', function() {
grunt.registerTask('test', 'run linting and the unit test suite', function() {
var tasks = [
'lint',
'flowbin:check',
'build-tests',
'mochaTest:unit',
'mochaTest:functional',
];

// TODO: enable the flowbin:check task on AppVeyor (mozilla/web-ext#773)
Expand All @@ -48,6 +47,27 @@ module.exports = function(grunt) {
grunt.task.run(tasks);
});

grunt.registerTask('test:functional', 'run functional test suites', [
'build-tests',
'mochaTest:functional',
]);

grunt.registerTask('copy-dist-files-to-artifacts-dir', function() {
const distFile = grunt.file.expand('./dist/**').filter((filename) => {
return filename.endsWith('web-ext.js');
});

if (distFile.length === 0) {
// By default grunt will exit here, unless the `--force` grunt option has been
// specified on the command line.
grunt.fail.warn(
'Required dist/ file missing. Run the build command first.'
);
}

grunt.task.run('copy:dist-files-to-artifacts-dir');
});

grunt.registerTask('develop', [
'flowbin:start',
'watch:develop',
Expand Down
10 changes: 10 additions & 0 deletions appveyor.yml
Expand Up @@ -21,3 +21,13 @@ test_script:
- set COVERAGE=y
- set NODE_ENV=production
- npm run test
## install the eslint version needed by eslint and run functional test suite
## (See #1082 for rationale).
## run functional test suite in a npm production environment
## (See #1082 for rationale).
- npm run copy-dist-files-to-artifacts-dir
- cd artifacts\production
- npm install --production
- cd ..\..
- set TEST_WEB_EXT_BIN=artifacts\production\bin\web-ext
- npm run test:functional
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -17,6 +17,8 @@
"flow-check": "grunt flowbin:check",
"lint": "grunt lint",
"test": "grunt test",
"test:functional": "grunt test:functional:run",
"copy-dist-files-to-artifacts-dir": "grunt copy-dist-files-to-artifacts-dir",
"publish-coverage": "grunt coveralls",
"nsp-check": "nsp check -o summary",
"changelog": "conventional-changelog -p angular -u",
Expand Down Expand Up @@ -46,7 +48,7 @@
"opera"
],
"dependencies": {
"addons-linter": "0.25.1",
"addons-linter": "0.26.1",
"babel-polyfill": "6.20.0",
"babel-runtime": "6.25.0",
"bunyan": "1.8.10",
Expand Down Expand Up @@ -96,6 +98,7 @@
"coveralls": "2.13.1",
"deepcopy": "0.6.3",
"doctoc": "1.3.0",
"eslint": "3.19.0",
"eslint-plugin-async-await": "0.0.0",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.3.0",
Expand Down
11 changes: 11 additions & 0 deletions tasks/configs/copy.js
@@ -0,0 +1,11 @@
module.exports = {
'dist-files-to-artifacts-dir': {
files: [
{
expand: true,
src: ['package.json', 'dist/**', 'bin/**'],
dest: 'artifacts/production',
},
],
},
};
4 changes: 3 additions & 1 deletion tests/functional/common.js
Expand Up @@ -13,7 +13,9 @@ export const withTempDir = tmpDirUtils.withTempDir;

export const functionalTestsDir = path.resolve(__dirname);
export const projectDir = path.join(functionalTestsDir, '..', '..');
export const webExt = path.join(projectDir, 'bin', 'web-ext');
export const webExt = process.env.TEST_WEB_EXT_BIN ?
path.resolve(process.env.TEST_WEB_EXT_BIN) :
path.join(projectDir, 'bin', 'web-ext');
export const fixturesDir = path.join(functionalTestsDir, '..', 'fixtures');
export const minimalAddonPath = path.join(fixturesDir, 'minimal-web-ext');
export const fakeFirefoxPath = path.join(
Expand Down

0 comments on commit 0e51fb0

Please sign in to comment.