Skip to content

Commit

Permalink
ci: Run tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Nov 8, 2021
1 parent b987284 commit 130fdd9
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 31 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/Test.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,42 @@
name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
Test:
runs-on: ${{ matrix.os }}
env:
TZ: Europe/Tallinn
defaults:
run:
shell: bash
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
steps:
- name: Set timezone on Windows
if: matrix.os == 'windows-latest'
run: tzutil /s "FLE Standard Time"
shell: cmd
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
cache: npm
cache-dependency-path: 'package.json'
- name: Install
run: npm install -g @litejs/cli jshint c8 uglify-js
- name: Lint
run: lj lint
- name: Test
run: npm run coverage
- name: Upload to Coveralls
if: matrix.os == 'ubuntu-latest'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

2 changes: 1 addition & 1 deletion cli/build.js
Expand Up @@ -39,7 +39,7 @@ var key
}
, commands = {
css: cssMin,
js: "uglifyjs --warn --ie8 -c 'evaluate=false,properties=false' -m eval --comments '/^\\s*[@!]/' --beautify 'beautify=false,semicolons=false,keep_quoted_props=true'",
js: "uglifyjs --config-file " + path.resolve(module.filename, "../minify.json"),
//esbuild --minify --target=es5 load.js
json: function(attrs) {
return JSON.stringify(JSON.parse(attrs._j))
Expand Down
17 changes: 17 additions & 0 deletions cli/minify.json
@@ -0,0 +1,17 @@
{
"warnings": true,
"ie8": true,
"compress": {
"evaluate": false,
"properties": false
},
"mangle": {
"eval": true
},
"output": {
"comments": "/^\\s*[@!]/",
"beautify": false,
"semicolons": false,
"keep_quoted_props": true
}
}
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -25,6 +25,9 @@
"lj-stat": "./cli/stat",
"lj": "./index.js"
},
"scripts": {
"coverage": "c8 -r lcov -r text-summary --check-coverage --branches=70 --functions=70 --lines=70 --statements=70 node --allow-natives-syntax --expose-gc -r ./test.js test/index.js --brief"
},
"litejs": {
"build": false,
"install": false,
Expand Down
4 changes: 2 additions & 2 deletions snapshot.js
Expand Up @@ -8,7 +8,7 @@ var cli = require(".")
describe.assert.cmdSnapshot = function(cmd, file) {
var actual
try {
actual = child.execSync(cmd).toString("utf8").replace(relPathRe, relPathFn)
actual = child.execSync(cmd).toString("utf8").replace(relPathRe, relPathFn).replace(/\\\\/g, "/")
} catch(e) {
return this(0, "Snapshot command failed: " + cmd + "\n---\n" + e.stdout.toString("utf8"))
}
Expand All @@ -20,7 +20,7 @@ describe.assert.matchSnapshot = function(file, transform) {
, actual = typeof transform === "function" ? transform(cli.readFile(file)) : transform || cli.readFile(file)

try {
expected = cli.readFile(file + ".snap").replace(relPathRe, relPathFn)
expected = cli.readFile(file + ".snap").replace(relPathRe, relPathFn).replace(/\\\\/g, "/")
} catch(e) {}
if (actual === expected) {
this.ok(1)
Expand Down

0 comments on commit 130fdd9

Please sign in to comment.