Skip to content

Commit

Permalink
ci: windows (#4213)
Browse files Browse the repository at this point in the history
* chore: try run scripts directly

* chore: only trigger windows ci

* chore: remove resolve-bin

* fix: windows ci

* fix: windows path

* chore: try path

* chore: print gen

* chore: remove linux test

* chore: debug windows path

* chore: compare unix system

* chore: try change path

* chore: noramlize path

* chore: switch windows

* fix: bug

* chore: windows ci

* chore: up timeout

* chore: up timeout

* chore: match more tests

* chore: clean code

* use path.posix.normalize

* ci: debug path

* chore: test utils

* chore: update logic

* chore: reduce diff content
  • Loading branch information
iChenLei authored Sep 14, 2023
1 parent 1b6dba1 commit 13864a6
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node: [10, 12, 14, 16, 19]
node: [10, 12, 14, 16, 20]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
Expand Down
27 changes: 1 addition & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"devDependencies": {
"github-changes": "^1.1.2",
"lerna": "^3.22.1",
"npm-run-all": "^4.1.5",
"resolve-bin": "~1.0.1"
"npm-run-all": "^4.1.5"
}
}
14 changes: 1 addition & 13 deletions packages/less/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

var resolve = require('resolve');
var path = require('path');
var resolveBin = require('resolve-bin')

var testFolder = path.relative(process.cwd(), path.dirname(resolve.sync('@less/test-data')));
var lessFolder = path.join(testFolder, 'less');
Expand Down Expand Up @@ -184,12 +183,6 @@ module.exports = function(grunt) {
// Make the SauceLabs jobs
["all"].concat(browserTests).map(makeJob);

var path = require('path');

// Handle async / await in Rollup build for tests
const tsNodeRuntime = resolveBin.sync('ts-node');
const crossEnv = resolveBin.sync('cross-env');

// Project configuration.
grunt.initConfig({
shell: {
Expand Down Expand Up @@ -223,12 +216,7 @@ module.exports = function(grunt) {
command: "node build/rollup.js --browser --out=./tmp/browser/less.min.js"
},
test: {
command: [
// https://github.com/TypeStrong/ts-node/issues/693#issuecomment-848907036
crossEnv + " TS_NODE_SCOPE=true",
tsNodeRuntime + " test/test-es6.ts",
"node test/index.js"
].join(' && ')
command: 'ts-node test/test-es6.ts && node test/index.js'
},
generatebrowser: {
command: 'node test/browser/generator/generate.js'
Expand Down
12 changes: 6 additions & 6 deletions packages/less/test/browser/generator/runner.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var path = require('path');
var resolve = require('resolve')
var { forceCovertToBrowserPath } = require('./utils');

/** Root of repo */
var rootFolder = path.resolve(__dirname, '../../../../../');
var testFolder = path.dirname(resolve.sync('@less/test-data'))
var lessFolder = path.join(testFolder, 'less');
var localTests = path.resolve(__dirname, '..');
var testFolder = forceCovertToBrowserPath(path.dirname(resolve.sync('@less/test-data')));
var lessFolder = forceCovertToBrowserPath(path.join(testFolder, 'less'));
var localTests = forceCovertToBrowserPath(path.resolve(__dirname, '..'));

module.exports = {
main: {
Expand Down Expand Up @@ -35,7 +35,7 @@ module.exports = {
}
},
strictUnits: {
src: [`${lessFolder}/strict-units/*.less`],
src: [`${lessFolder}/units/strict/*.less`],
options: {
helpers: 'test/browser/runner-strict-units-options.js',
specs: 'test/browser/runner-strict-units-spec.js',
Expand Down Expand Up @@ -185,4 +185,4 @@ module.exports = {
outfile: 'tmp/browser/test-runner-filemanager-plugin.html'
}
}
}
}
7 changes: 4 additions & 3 deletions packages/less/test/browser/generator/template.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const html = require('html-template-tag')
const path = require('path')
const { forceCovertToBrowserPath } = require('./utils')

const webRoot = path.resolve(__dirname, '../../../../../');
const mochaDir = path.relative(webRoot, path.dirname(require.resolve('mocha')))
const chaiDir = path.relative(webRoot, path.dirname(require.resolve('chai')))
const mochaTeamCityDir = path.relative(webRoot, path.dirname(require.resolve('mocha-teamcity-reporter')))
const mochaDir = forceCovertToBrowserPath(path.relative(webRoot, path.dirname(require.resolve('mocha'))))
const chaiDir = forceCovertToBrowserPath(path.relative(webRoot, path.dirname(require.resolve('chai'))))
const mochaTeamCityDir = forceCovertToBrowserPath(path.relative(webRoot, path.dirname(require.resolve('mocha-teamcity-reporter'))))

/**
* Generates HTML templates from list of test sheets
Expand Down
14 changes: 14 additions & 0 deletions packages/less/test/browser/generator/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* utils for covert browser paths,
* fix https://github.com/less/less.js/pull/4213
*
* @param {string} path
* @returns {string}
*/
function forceCovertToBrowserPath (path) {
return (path || '').replace(/\\/g, '/');
}

module.exports = {
forceCovertToBrowserPath
}

0 comments on commit 13864a6

Please sign in to comment.