diff --git a/.github/node-chrome/Dockerfile b/.github/node-chrome/Dockerfile deleted file mode 100644 index 4e743b138..000000000 --- a/.github/node-chrome/Dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -# Taken from https://raw.githubusercontent.com/filipesilva/ng-github-actions/master/.github/node-chrome/Dockerfile -# and https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker -FROM node:12 - -# See https://crbug.com/795759 -RUN apt-get update && apt-get install -yq libgconf-2-4 - -# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) -# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer -# installs, work. -RUN apt-get update && apt-get install -y wget --no-install-recommends \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && apt-get update \ - && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get purge --auto-remove -y curl \ - && rm -rf /src/*.deb diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e117e0d17..37bd36da0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,20 +1,75 @@ -on: [push, pull_request] +name: CI -name: build and test +on: [push, pull_request] jobs: - build_and_test: + comparison_test: + name: Comparison Test runs-on: ubuntu-latest + timeout-minutes: 15 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + + - name: install + run: yarn install + + - name: build + run: yarn build + + - name: install typescript + run: yarn add typescript@3.9.3 + + - name: test + run: sudo yarn comparison-tests + + windows: + name: Windows Test + runs-on: windows-latest + timeout-minutes: 25 + steps: + - uses: actions/checkout@v2 + + - name: copy files + shell: pwsh + run: | + New-Item C:\source\ts-loader -ItemType Directory + Copy-Item .\* C:\source\ts-loader -Recurse -Force + + - name: install + run: yarn install + working-directory: C:\source\ts-loader + + - name: build + run: yarn build + working-directory: C:\source\ts-loader + + - name: install typescript + run: yarn add typescript@3.9.3 + working-directory: C:\source\ts-loader + + - name: test + run: yarn comparison-tests + working-directory: C:\source\ts-loader + + execution_test: + name: Execution Test + strategy: + matrix: + os: [ubuntu] + node: [10, 12, 14] + ts: [3.6.5, 3.7.5, 3.8.3, 3.9.3, next] + include: + - os: windows + node: 14 + ts: 3.9.3 + runs-on: ${{ matrix.os }}-latest + steps: + - uses: actions/checkout@v2 - name: install node uses: actions/setup-node@v1 with: - node-version: 12 - - - name: upgrade yarn - run: npm install yarn -g + node-version: ${{ matrix.node }} - name: install run: yarn install @@ -22,8 +77,20 @@ jobs: - name: build run: yarn build - - name: install chrome - uses: ./.github/node-chrome + - name: install typescript + run: yarn add typescript@${{ matrix.ts }} - name: test run: yarn execution-tests + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: install + run: yarn install + + - name: lint + run: yarn lint diff --git a/.travis.yml b/.travis.yml index 42bb7c136..e05401a9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,4 +19,3 @@ env: - TYPESCRIPT=typescript@3.8.2 - TYPESCRIPT=typescript@3.7.4 - TYPESCRIPT=typescript@3.6.3 - diff --git a/appveyor.yml b/appveyor.yml index 38eed8ed7..bb1fa65dd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ environment: - TYPESCRIPT: typescript@3.8.2 - TYPESCRIPT: typescript@3.7.4 - TYPESCRIPT: typescript@3.6.3 - + install: - ps: Install-Product node $env:nodejs_version - yarn install diff --git a/test/comparison-tests/create-and-execute-test.js b/test/comparison-tests/create-and-execute-test.js index 074ef1d84..b97d64095 100644 --- a/test/comparison-tests/create-and-execute-test.js +++ b/test/comparison-tests/create-and-execute-test.js @@ -68,9 +68,9 @@ if (fs.statSync(testPath).isDirectory() && /** * Create a Jasmine test - * @param {string} test - * @param {string} testPath - * @param {any} options + * @param {string} test + * @param {string} testPath + * @param {any} options */ function createTest(test, testPath, options) { return function (done) { @@ -177,7 +177,7 @@ function createWebpackConfig(paths, optionsOriginal, useWatchApi) { const tsLoaderPath = path.join(__dirname, "../../index.js"); aliasLoader(config, tsLoaderPath, options); - + config.context = paths.outputPath; paths.outputPath = config.output.path = config.output.path || paths.outputPath; config.resolveLoader = config.resolveLoader || {}; @@ -401,11 +401,11 @@ function getNormalisedFileContent(file, location) { return 'at ' + remainingPathAndColon + 'irrelevant-line-number' + colon + 'irrelevant-column-number'; }) // strip C:/projects/ts-loader/.test/ - .replace(/(C\:\/)?[\w|\/]*\/(ts-loader|workspace)\/\.test/ig, '') - .replace(/webpack:\/\/(C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'webpack://comparison-tests/') - .replace(/WEBPACK FOOTER\/n\/ (C:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/') - .replace(/!\** (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '!*** /ts-loader/test/comparison-tests/') - .replace(/\/ (C\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '/ /ts-loader/test/comparison-tests/') + .replace(/([a-zA-Z]\:\/)?[\w|\/]*\/(ts-(loader)?|workspace)\/\.test/ig, '') + .replace(/webpack:\/\/([a-zA-Z]:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'webpack://comparison-tests/') + .replace(/WEBPACK FOOTER\/n\/ ([a-zA-Z]:\/)?[\w|\/|-]*\/comparison-tests\//ig, 'WEBPACK FOOTER/n/ /ts-loader/test/comparison-tests/') + .replace(/!\** ([a-zA-Z]\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '!*** /ts-loader/test/comparison-tests/') + .replace(/\/ ([a-zA-Z]\:\/)?[\w|\/|-]*\/comparison-tests\//ig, '/ /ts-loader/test/comparison-tests/') // with webpack 4 there are different numbers of *s on Windows and on Linux .replace(/\*{10}\**/g, '**********'); } catch (e) { @@ -425,9 +425,9 @@ function normaliseString(platformSpecificContent) { .replace(new RegExp(regexEscape('\\'), 'g'), '/') .replace(new RegExp(regexEscape('//'), 'g'), '/') // replace C:/source/ts-loader/index.js or /home/travis/build/TypeStrong/ts-loader/index.js with ts-loader - .replace(/ \S+[\/|\\](ts-loader|workspace)[\/|\\]index.js/g, 'ts-loader') + .replace(/ \S+[\/|\\](ts-(loader)?|workspace)[\/|\\]index.js/g, 'ts-loader') // replace (C:/source/ts-loader/dist/index.js with (ts-loader) - .replace(/\(\S+[\/|\\](ts-loader|workspace)[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)'); + .replace(/\(\S+[\/|\\](ts-(loader)?|workspace)[\/|\\]dist[\/|\\]index.js:\d*:\d*\)/g, '(ts-loader)'); } /** diff --git a/test/comparison-tests/run-tests.js b/test/comparison-tests/run-tests.js index bf4cf448a..48d403db6 100644 --- a/test/comparison-tests/run-tests.js +++ b/test/comparison-tests/run-tests.js @@ -182,7 +182,7 @@ function runTestAsChildProcess(testName) { const testToRun = ' --test-to-run ' + testName; const debug = process.argv.indexOf('--debug') > -1; const testCommand = - 'mocha --reporter spec ' + + 'mocha -c --reporter spec ' + (debug ? '--inspect-brk=5858 ' : '') + 'test/comparison-tests/create-and-execute-test.js ' + testToRun;