Skip to content

Commit

Permalink
Merge pull request Automattic#12918 from hasezoey/denoToMMS
Browse files Browse the repository at this point in the history
Change deno tests to also use MMS
  • Loading branch information
vkarpov15 committed Feb 13, 2023
2 parents cdb8da0 + 7900274 commit b3e461a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,25 @@ jobs:
test-deno:
runs-on: ubuntu-20.04
name: Deno tests
env:
MONGOMS_VERSION: 6.0.0
MONGOMS_PREFER_GLOBAL_PATH: 1
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.0.2
- name: Setup
run: |
wget -q https://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu2004-6.0.0.tgz
tar xf mongodb-linux-x86_64-ubuntu2004-6.0.0.tgz
mkdir -p ./data/db/27017 ./data/db/27000
printf "\ntimeout: 8000" >> ./.mocharc.yml
./mongodb-linux-x86_64-ubuntu2004-6.0.0/bin/mongod --setParameter ttlMonitorSleepSecs=1 --fork --dbpath ./data/db/27017 --syslog --port 27017
sleep 2
mongod --version
echo `pwd`/mongodb-linux-x86_64-ubuntu2004-6.0.0/bin >> $GITHUB_PATH
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Setup node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 16
- name: Load MongoDB binary cache
id: cache-mongodb-binaries
uses: actions/cache@v3
with:
path: ~/.cache/mongodb-binaries
key: deno-${{ env.MONGOMS_VERSION }}
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.28.x
deno-version: v1.30.x
- run: deno --version
- run: npm install
- name: Run Deno tests
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"release-legacy": "git pull origin 5.x && git push origin 5.x --tags && npm publish --tag legacy",
"mongo": "node ./tools/repl.js",
"test": "mocha --exit ./test/*.test.js",
"test-deno": "deno run --allow-env --allow-read --allow-net --allow-run --allow-sys ./test/deno.js",
"test-deno": "deno run --allow-env --allow-read --allow-net --allow-run --allow-sys --allow-write ./test/deno.js",
"test-rs": "START_REPLICA_SET=1 mocha --timeout 30000 --exit ./test/*.test.js",
"test-tsd": "node ./test/types/check-types-filename && tsd",
"tdd": "mocha ./test/*.test.js --inspect --watch --recursive --watch-files ./**/*.{js,ts}",
Expand Down
9 changes: 8 additions & 1 deletion test/deno.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ const Mocha = require('mocha');
const fs = require('fs');
const path = require('path');

const fixtures = require('./mocha-fixtures.js')

const mocha = new Mocha({
timeout: 8000,
...(args.g ? { fgrep: '' + args.g } : {})
});

// the following is required because mocha somehow does not load "require" options and so needs to be manually set-up
mocha.globalSetup(fixtures.mochaGlobalSetup);
mocha.globalTeardown(fixtures.mochaGlobalTeardown);

const testDir = 'test';

const files = fs.readdirSync(testDir).
concat(fs.readdirSync(path.join(testDir, 'docs')).map(file => path.join('docs', file))).
concat(fs.readdirSync(path.join(testDir, 'helpers')).map(file => path.join('helpers', file)));
Expand All @@ -41,4 +48,4 @@ for (const file of files) {
mocha.run(function(failures) {
process.exitCode = failures ? 1 : 0; // exit with non-zero status if there were failures
process.exit(process.exitCode);
});
});

0 comments on commit b3e461a

Please sign in to comment.