Skip to content

Commit

Permalink
Merge branch 'visionmedia:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ltxhhz authored May 29, 2022
2 parents c719f0c + 9ed2916 commit 4611a6b
Show file tree
Hide file tree
Showing 40 changed files with 1,624 additions and 1,204 deletions.
14 changes: 12 additions & 2 deletions .dist.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["eslint:recommended"],
"extends": ["eslint:recommended", "plugin:compat/recommended"],
"env": {
"node": false,
"browser": true,
Expand All @@ -8,6 +8,14 @@
},
"plugins": ["compat"],
"rules": {
"node/no-unsupported-features/es-builtins": ["error", {
"version": ">=8.0.0",
"ignores": [
"Atomics",
"BigInt",
"SharedArrayBuffer"
]
}],
"compat/compat": "error",
"no-console": "off",
"no-empty": "off",
Expand Down Expand Up @@ -44,7 +52,9 @@
"Reflect",
"WeakMap",
"WeakRef",
"WeakSet"
"WeakSet",
"Atomics",
"SharedArrayBuffer"
]
}
}
38 changes: 38 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"extends": [
"eslint:recommended",
"plugin:node/recommended"
],
"env": {
"node": true,
"browser": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2021
},
"overrides": [
{
"files": "test/**/*.js",
"env": {
"mocha": true
},
"rules": {
"no-prototype-builtins": "off",
"node/no-deprecated-api": "warn",
"node/no-extraneous-require": "warn",
"no-unused-vars": "warn"
}
}
],
"rules": {
"node/no-unsupported-features/node-builtins": "off",
"node/no-unsupported-features/es-syntax": "off",
"node/no-exports-assign": "off"
},
"globals": {
"ActiveXObject": "readonly"
}


}
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI
on: [push, pull_request]

env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- node-version: 10.x
test-on-old-node: 1
- node-version: 12.x
# test-on-brower: 1
- node-version: 14.x
- node-version: 16.x
steps:
- uses: actions/checkout@v2

- name: Install Node - ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies On Old Node ${{ matrix.node-version }}
if: ${{ matrix.test-on-old-node == '1' }}
run: yarn install --ignore-optional --ignore-scripts
- name: Install Dependencies On Node ${{ matrix.node-version }}
if: ${{ matrix.test-on-old-node != '1' }}
run: yarn install
- name: Build
run: npm run build
- name: Build On Old Node
if: ${{ matrix.test-on-old-node == '1' }}
run: npm run build:test
- name: Test On Node ${{ matrix.node-version }}
env:
BROWSER: ${{ matrix.test-on-brower }}
HTTP2_TEST_DISABLED: ${{ matrix.http2-test-disabled }}
OLD_NODE_TEST: ${{ matrix.test-on-old-node }}
run: |
if [ "$OLD_NODE_TEST" = "1" ]; then
make test
else
npm run lint
make test
fi
- name: Coverage On Node ${{ matrix.node-version }}
run:
npm run coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode
build
lib-cov
coverage.html
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# enable next line when tests are fixed
# npm test
20 changes: 10 additions & 10 deletions .lib.babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"presets": [
["@babel/env", {
"targets": {
"node": "6.4.0",
"browsers": [ "> 1%", "last 2 versions", "ie 9" ]
}
}]
],
"sourceMaps": "inline"
}
"presets": [
["@babel/env", {
"targets": {
"node": "6.4.0",
"browsers": [ "> 1%", "last 2 versions", "ie 9" ]
}
}]
],
"sourceMaps": "inline"
}
8 changes: 7 additions & 1 deletion .lib.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"no-console": "off",
"no-unused-vars": "off",
"no-empty": "off",
"node/no-unsupported-features/node-builtins": "off",
"no-func-assign": "off",
"no-global-assign": ["error", {"exceptions": ["exports"]}],
"no-fallthrough": "off",
Expand All @@ -22,6 +21,13 @@
"globals": {
"ActiveXObject": "readable"
}
},
{
"files": [ "lib/node/http2wrapper.js" ],
"rules": {
"node/no-unsupported-features/es-builtins": "off",
"node/no-unsupported-features/node-builtins": "off"
}
}
]
}
12 changes: 0 additions & 12 deletions .npmignore

This file was deleted.

17 changes: 17 additions & 0 deletions .test.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"presets": [
["@babel/env", {
"targets": {
"node": "6.4.0",
"browsers": [ "> 1%", "last 2 versions", "ie 9" ]
}
}]
],
"plugins": [
["@babel/transform-runtime"]
],
"parserOpts": {
"allowReturnOutsideFunction": true
},
"sourceMaps": "inline"
}
43 changes: 29 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@

OLDNODETESTS ?= lib/node/test/*.js lib/node/test/node/*.js
NODETESTS ?= test/*.js test/node/*.js
BROWSERTESTS ?= test/*.js test/client/*.js
REPORTER = spec

ifeq ("$(OLD_NODE_TEST)", "1")
NODETESTS := $(OLDNODETESTS)
endif

test:
@if [ "x$(BROWSER)" = "x" ]; then make test-node; else make test-browser; fi
@if [ "$(BROWSER)" = "1" ]; then \
echo test on browser; \
make test-browser; \
fi \

test-node:
@NODE_ENV=test ./node_modules/.bin/mocha \
--require should \
--trace-warnings \
--throw-deprecation \
--reporter $(REPORTER) \
--timeout 5000 \
--exit \
$(NODETESTS)
@if [ "$(NODE_TEST)" = "1" ] || [ "x$(BROWSER)" = "x" ]; then \
echo test on node with http1; \
export HTTP2_TEST="" && make test-node; \
if [ "$(HTTP2_TEST_DISABLED)" != "1" ]; then \
echo test on node with http2; \
export HTTP2_TEST="1" && make test-node; \
fi \
fi

copy:
@if [ "$(OLD_NODE_TEST)" = "1" ]; then \
echo test on old node; \
cp test/node/fixtures lib/node/test/node -rf; \
else \
echo test on plain node; \
fi

test-node-http2:
@NODE_ENV=test HTTP2_TEST=1 node ./node_modules/.bin/mocha \
test-node:copy
@NODE_ENV=test HTTP2_TEST=$(HTTP2_TEST) ./node_modules/.bin/nyc ./node_modules/.bin/mocha \
--require should \
--trace-warnings \
--throw-deprecation \
--reporter $(REPORTER) \
--slow 2000 \
--timeout 5000 \
--exit \
$(NODETESTS)
Expand Down Expand Up @@ -59,4 +74,4 @@ test-docs: docs/head.html docs/tail.html
clean:
rm -fr components

.PHONY: test-cov test docs test-docs clean test-browser-local
.PHONY: copy test-cov test docs test-docs clean test-browser-local
Loading

0 comments on commit 4611a6b

Please sign in to comment.