Skip to content

Commit

Permalink
Merge pull request #34 from w3c/ci-npm-test
Browse files Browse the repository at this point in the history
Add node test github workflow
  • Loading branch information
jugglinmike authored Apr 2, 2024
2 parents 9766fc2 + 9ce10d0 commit d46c0a5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
###############################################################################
* text=auto

lib/**/* text eol=lf
test/**/* text eol=lf

# Declare files that will always have CRLF line endings on checkout.
src/automationttsengine/**/* text eol=crlf
src/makevoice/**/* text eol=crlf
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Node.js CI

on: [push, pull_request]

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [windows-2022]
node-version: ['18.x']
test-command:
- npm run test-style
- npm run test-types
- npm run test-unit

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: ${{ matrix.test-command }}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
},
"scripts": {
"prettier": "prettier --write lib test",
"test": "prettier --check lib test && npm run test-types && npm run test-unit",
"test-unit": "mocha --ui tdd test/**/*.js",
"test-types": "tsc -p tsconfig.json"
"test": "npm run test-style && npm run test-types && npm run test-unit",
"test-style": "prettier --check lib test",
"test-types": "tsc -p tsconfig.json",
"test-unit": "mocha --ui tdd test/**/*.js"
},
"files": [
"lib",
Expand Down
8 changes: 8 additions & 0 deletions test/helpers/macos/applescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ const {
} = require('../../../lib/helpers/macos/applescript.js');
const { parseCodePoints } = require('../../../lib/helpers/macos/parseCodePoints.js');
const { keyCodeCommand } = require('../../../lib/helpers/macos/keyCodeCommand.js');
const IS_MACOS = require('os').platform() === 'darwin';

suite('helpers/macos/applescript', () => {
suiteSetup(function () {
if (!IS_MACOS) {
this.skip();
return;
}
});

suite('parseCodePoints', () => {
test('space', () => {
assert.deepEqual(parseCodePoints([' ']), keyCodeCommand(['space'], []));
Expand Down

0 comments on commit d46c0a5

Please sign in to comment.