Skip to content

Commit

Permalink
test: add error count check
Browse files Browse the repository at this point in the history
  • Loading branch information
anantoghosh committed Feb 24, 2021
1 parent e611920 commit 3c9307c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
10 changes: 9 additions & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,22 @@ const stdio = 'inherit';
);

console.log('Installing this package locally');
await execa.command('npm i -D ../eslint-config-good-code-1.0.2.tgz', {
await execa.command('npm i -D ../eslint-config-good-code-1.0.2.tgz --force', {
stdio,
});

console.log('Running eslint test');
await execa.command('npm run test', {
stdio,
});

const result = require('../test/1.json');

if (result[0]['errorCount'] !== 7) {
throw new Error('Eslint error count mismatch');
}

console.log("Test passed ✅");
} catch (error) {
console.error(error);
}
Expand Down
14 changes: 2 additions & 12 deletions test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint-config-good-code"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
}
root: true,
extends: ['eslint-config-good-code'],
};
12 changes: 12 additions & 0 deletions test/1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ if (Math.random() > 0) {
if (Math.random() > 1) {
}
}

function calculateCode() {
const x = 1;
const y = 0;
return x + y;
}

function getName() {
const x = 1;
const y = 0;
return x + y;
}

0 comments on commit 3c9307c

Please sign in to comment.