From 65bdc9bfbfc1e6d58d9fa733f9f3ebec7e14af39 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 27 Apr 2021 09:18:27 +0100 Subject: [PATCH] fix: use cjs for exports - Only export cjs code and let bundlers figure the rest out - Removes old bower/grunt toolchain - Adds standard for linting - Fixes all linting errors - Updates all deps - Removes peer deps since they get installed by default with npm7 - Replaces travis CI with github actions - Removes require-uncached as it doesn't bundle due to needing node internals and the tests pass without it? --- .github/workflows/main.yml | 42 + .jshintrc | 34 - .travis.yml | 14 - Gruntfile.js | 36 - bower.json | 21 - lib/dirty-chai.js | 267 +- package-lock.json | 10586 ++++++++++++++++++++++++++++++----- package.json | 26 +- test/common.js | 2 +- test/dirty-chai.spec.js | 279 +- 10 files changed, 9364 insertions(+), 1943 deletions(-) create mode 100644 .github/workflows/main.yml delete mode 100644 .jshintrc delete mode 100644 .travis.yml delete mode 100644 Gruntfile.js delete mode 100644 bower.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..009e9ce --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,42 @@ +name: ci +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm install + - run: npm run lint + test-node: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + node: [14, 15] + fail-fast: true + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node }} + - run: npm install + - run: npm run test:node + test-chrome: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm install + - run: npm run test:chrome + test-firefox: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: npm install + - run: npm run test:firefox diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index b2a0920..0000000 --- a/.jshintrc +++ /dev/null @@ -1,34 +0,0 @@ -{ - "node": true, - "browser": true, - "esnext": true, - "bitwise": true, - "camelcase": true, - "curly": true, - "eqeqeq": true, - "immed": true, - "indent": 2, - "latedef": true, - "newcap": true, - "noarg": true, - "quotmark": "single", - "regexp": true, - "undef": true, - "unused": true, - "strict": true, - "trailing": true, - "smarttabs": true, - "globals": { - "_": true, - "describe": true, - "beforeEach": true, - "afterEach": true, - "before": true, - "after": true, - "it": true, - "expect": true, - "define": true, - "chai": true, - "AssertionError": true - } -} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f3fc4b5..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: node_js -node_js: - - "4" - - "6" -env: - - CHAI_VERSION=^2.1.2 - - CHAI_VERSION=^3.0.0 - - CHAI_VERSION=^4.0.0 -before_install: - npm install -g grunt-cli -before_script: - npm install chai@$CHAI_VERSION -script: - grunt ci diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 316b17f..0000000 --- a/Gruntfile.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict'; - -module.exports = function (grunt) { - require('load-grunt-tasks')(grunt); - - grunt.initConfig({ - watch: { - testNLint: { - files: '{lib,test}/**/*.js', - tasks: ['jshint', 'mochaTest'] - }, - }, - - jshint: { - options: { - jshintrc: '.jshintrc', - reporter: require('jshint-stylish'), - reporterOutput: '' - }, - all: '{lib,test}/**/*.js' - }, - - mochaTest: { - options: { - reporter: 'spec', - globals: ['chai', 'should'], - require: 'test/common' - }, - src: 'test/**/*.spec.js' - }, - }); - - grunt.registerTask('dev', ['watch']); - grunt.registerTask('test', ['mochaTest']); - grunt.registerTask('ci', ['jshint:all', 'mochaTest']); -}; diff --git a/bower.json b/bower.json deleted file mode 100644 index 747e02c..0000000 --- a/bower.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "dirty-chai", - "description": "Extends Chai with lint-friendly terminating assertions.", - "main": "./lib/dirty-chai.js", - "repository": { - "type": "git", - "url": "https://github.com/prodatakey/dirty-chai" - }, - "ignore": [ - "Gruntfile.js", - "package.json", - "test/" - ], - "keywords": [ - "chai", - "testing" - ], - "dependencies": { - "chai": "<1.10.0 || >1.10.0 <4" - } -} diff --git a/lib/dirty-chai.js b/lib/dirty-chai.js index ad915f0..17ef431 100644 --- a/lib/dirty-chai.js +++ b/lib/dirty-chai.js @@ -1,77 +1,63 @@ -'use strict'; - -(function (dirtyChai) { - // Inject into various module systems - if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { - // Node - module.exports = dirtyChai; - } else if (typeof define === 'function' && define.amd) { - // AMD - define(function () { - return dirtyChai; - }); - } else { - // Other environment (usually