Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update deps and fix problems #83

Merged
merged 6 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 33 additions & 52 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: tests
env:
CI: true
Expand All @@ -12,78 +9,62 @@ on:
branches: [ master ]

jobs:
chromium_linux:
name: "Chromium Linux"
linux:
name: "Linux"
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node: [12, 14]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: ${{ matrix.node }}
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install libgbm-dev
sudo apt-get install libgbm-dev libwoff1 libopus0 libwebp6 libwebpdemux2 libenchant1c2a libgudev-1.0-0 libsecret-1-0 libhyphen0 libgdk-pixbuf2.0-0 libegl1 libgles2 libevent-2.1-6 libnotify4 libxslt1.1
sudo apt-get install xvfb
- run: yarn
- run: ./cli.js mocks/test.mocha.js
- run: ./cli.js mocks/test.mocha.js --incognito
- run: ./cli.js mocks/test.mocha.js --mode worker
- run: xvfb-run -a ./cli.js mocks/test.mocha.js --extension
- run: ./cli.js mocks/test.tape.js --runner tape
- run: ./cli.js mocks/benchmark.js --runner benchmark
- run: RUN_ONLY=true INDENT=true ./cli.js 'mocks/*.zora.js' --runner zora
- run: yarn lint
- run: xvfb-run -a yarn test
- run: ./cli.js mocks/test.mocha.js --browser firefox
- run: ./cli.js mocks/test.mocha.js --browser webkit

chromium_macos:
name: "Chromium Mac"
macos:
name: "Mac"
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
node: [12, 14]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: ${{ matrix.node }}
- run: yarn
- run: ./cli.js mocks/test.mocha.js
- run: yarn test
- run: ./cli.js mocks/test.mocha.js --browser firefox
- run: ./cli.js mocks/test.mocha.js --browser webkit

chromium_win:
name: "Chromium Win"
win:
name: "Win"
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
node: [12, 14]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: ${{ matrix.node }}
- run: yarn
- run: ./cli.js mocks/test.mocha.js
- run: yarn test
shell: bash

webkit_linux:
name: "WebKit Linux"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install libwoff1 libopus0 libwebp6 libwebpdemux2 libenchant1c2a libgudev-1.0-0 libsecret-1-0 libhyphen0 libgdk-pixbuf2.0-0 libegl1 libgles2 libevent-2.1-6 libnotify4 libxslt1.1
sudo apt-get install xvfb
- run: yarn
- run: ./cli.js mocks/test.mocha.js --browser webkit

firefox_linux:
name: "Firefox Linux"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install xvfb
- run: yarn
- run: ./cli.js mocks/test.mocha.js --browser firefox
shell: bash
- run: ./cli.js mocks/test.mocha.js --browser webkit
shell: bash
3 changes: 2 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ Usage
default: process.cwd()
},
extensions: {
type: 'array',
type: 'string',
isMultiple: true,
default: ['js', 'cjs', 'mjs']
},
assets: {
Expand Down
6 changes: 6 additions & 0 deletions mocks/test.mocha.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-undef */
// eslint-disable-next-line strict
const assert = require('assert');
const debug = require('debug')('app');

describe('Array', () => {
describe('#indexOf()', () => {
Expand All @@ -12,5 +13,10 @@ describe('Array', () => {
// console.log(chrome);
assert.equal([1, 2, 3].indexOf(2), 1);
});

it('should pass with debug', () => {
assert.equal([1, 2, 3].indexOf(4), -1);
debug('test pass');
});
});
});
53 changes: 26 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "playwright-test",
"version": "0.7.1",
"description": "Run mocha or tape unit tests inside real browsers with playwright.",
"description": "Run unit tests with several runners or benchmark inside real browsers with playwright.",
"repository": "hugomrdias/playwright-test",
"author": "Hugo Dias <hugomrdias@gmail.com> (hugodias.me)",
"license": "MIT",
Expand All @@ -11,10 +11,9 @@
"node": ">=10"
},
"scripts": {
"test": "nyc ava",
"test": "uvu",
"lint": "eslint --cache *.js src/*.js",
"validate": "run-p lint test",
"precommit": "yarn validate",
"version": "yarn changelog && git add changelog.md",
"changelog": "conventional-changelog -p angular -i changelog.md -s -r 0"
},
Expand All @@ -36,49 +35,49 @@
"zora"
],
"dependencies": {
"camelcase": "^5.3.1",
"delay": "^4.3.0",
"camelcase": "^6.2.0",
"delay": "^4.4.0",
"env-paths": "^2.2.0",
"get-port": "^5.1.1",
"globby": "^11.0.0",
"ignore-by-default": "^1.0.1",
"kleur": "^3.0.3",
"meow": "^6.1.0",
"merge-options": "^2.0.0",
"ora": "^4.0.3",
"globby": "^11.0.1",
"ignore-by-default": "^2.0.0",
"kleur": "^4.1.3",
"meow": "^8.0.0",
"merge-options": "^3.0.3",
"ora": "^5.1.0",
"playwright-core": "0.11.1",
"polka": "^0.5.2",
"resolve-cwd": "^3.0.0",
"sirv": "^0.4.2",
"tempy": "^0.5.0",
"sirv": "^1.0.7",
"tempy": "^1.0.0",
"webpack": "^4.42.1",
"webpack-merge": "^4.2.2"
},
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"assert": "^2.0.0",
"ava": "^3.5.2",
"benchmark": "^2.1.4",
"conventional-changelog-cli": "^2.0.31",
"debug": "^4.1.1",
"conventional-changelog-cli": "^2.1.1",
"debug": "^4.2.0",
"eslint": "^4.7.1",
"eslint-config-halo": "^2.3.3",
"esm": "^3.2.25",
"husky": "^4.2.3",
"lint-staged": "^10.1.0",
"lodash": "^4.17.15",
"mocha": "^7.1.1",
"np": "^6.2.0",
"execa": "^4.1.0",
"husky": "^4.3.0",
"lint-staged": "^10.5.1",
"lodash": "^4.17.20",
"mocha": "^8.2.1",
"np": "^7.0.0",
"npm-run-all": "^4.1.1",
"nyc": "^15.0.0",
"tap-spec": "^5.0.0",
"tape": "^4.13.2",
"zora": "^3.1.8"
"tape": "^5.0.1",
"uvu": "^0.4.0",
"zora": "^4.0.1"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-commit": "yarn test && lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
Expand Down
87 changes: 83 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,87 @@
'use strict';

const test = require('ava');
const m = require('.');
const { test } = require('uvu');
const assert = require('uvu/assert');
const execa = require('execa');

test('title', (t) => {
t.is(m('unicorns'), 'unicorns & rainbows');
test('mocha', async () => {
const proc = await execa('./cli.js', ['mocks/test.mocha.js']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('3 passing'), 'process stdout');
});

test('mocha with DEBUG=app', async () => {
const proc = await execa('./cli.js', ['mocks/test.mocha.js'], { env: { DEBUG: 'app' } });

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('3 passing'), 'process stdout');
assert.ok(proc.stdout.includes('app test pass'), 'debug output');
});

test('mocha incognito', async () => {
const proc = await execa('./cli.js', ['mocks/test.mocha.js', '--incognito']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('3 passing'), 'process stdout');
});

test('mocha mode:worker', async () => {
const proc = await execa('./cli.js', ['mocks/test.mocha.js', '--mode', 'worker']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('3 passing'), 'process stdout');
});

test('mocha extension', async () => {
const proc = await execa('./cli.js', ['mocks/test.mocha.js', '--extension']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('3 passing'), 'process stdout');
});

test('tape', async () => {
const proc = await execa('./cli.js', ['mocks/test.tape.js', '--runner', 'tape']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('# pass 2'), 'process stdout');
});

test('tape mode:worker', async () => {
const proc = await execa('./cli.js', ['mocks/test.tape.js', '--runner', 'tape', '--mode', 'worker']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('# pass 2'), 'process stdout');
});

test('zora', async () => {
const proc = await execa('./cli.js', ['mocks/*.zora.js', '--runner', 'zora'], {
env: {
'RUN_ONLY': true,
'INDENT': true
}
});

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('# success: 2'), 'process stdout');
});

test('zora mode:worker', async () => {
const proc = await execa('./cli.js', ['mocks/*.zora.js', '--runner', 'zora', '--mode', 'worker'], {
env: {
'RUN_ONLY': true,
'INDENT': true
}
});

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('# success: 2'), 'process stdout');
});

test.skip('benchmark', async () => {
const proc = await execa('./cli.js', ['mocks/benchmark.js', '--runner', 'benchmark']);

assert.is(proc.exitCode, 0, 'exit code');
assert.ok(proc.stdout.includes('Fastest is String#indexOf'), 'process stdout');
});
test.run();
Loading