Skip to content

Instantly share code, notes, and snippets.

@joaovictornsv
Last active June 14, 2021 12:24
Show Gist options
  • Save joaovictornsv/25b62efad70e92fc9b6fde6d0473420c to your computer and use it in GitHub Desktop.
Save joaovictornsv/25b62efad70e92fc9b6fde6d0473420c to your computer and use it in GitHub Desktop.
🟡 Setup Node Javascript
"rules": {
"camelcase":"off",
"no-console":"off",
"no-unused-vars": "warn",
"class-methods-use-this": "off",
"import/prefer-default-export": "off",
"import/extensions": [
"error",
"always",
{
"js": "never"
}
],
"consistent-return": "off"
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js"]
}
}
}
dist
node_modules
coverage
module.exports = {
'*.js': 'yarn test --findRelatedTests'
}
const path = require('path');
module.exports = {
config: path.resolve(__dirname, 'src', 'config', 'database.js'),
'migrations-path': path.resolve(__dirname, 'src', 'database', 'migrations')
};
module.exports = {
// Stop running tests after `n` failures
bail: true,
// Automatically clear mock calls and instances between every test
clearMocks: true,
// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
'src/controllers/*.js',
'src/repositories/*.js',
'src/services/*.js',
'src/middlewares/*.js',
'src/validators/*.js',
],
// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: [
"/node_modules/"
],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// The test environment that will be used for testing
testEnvironment: "node",
}
{
"name": "my_app",
"version": "1.0.0",
"main": "src/server.js",
"license": "MIT",
"scripts": {
"dev": "nodemon src/server.js",
"test": "NODE_ENV=test jest --runInBand --no-cache",
"test:coverage": "yarn test --coverage"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment