diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eece32b..08e0114 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,6 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: "14" + node-version: "16" - run: npm ci - run: npm test diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index ece916a..6d6d8d1 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -12,10 +12,10 @@ jobs: # Setup .npmrc file to publish to npm - uses: actions/setup-node@v3 with: - node-version: "14" + node-version: "16" registry-url: "https://registry.npmjs.org" - run: npm ci - - run: npm publish --dry-run + - run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # https://javascript.plainenglish.io/publish-update-npm-packages-with-github-actions-e4d786ffd62a diff --git a/.gitignore b/.gitignore index cbbaefb..49277e3 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,6 @@ files.json project-lock.json test/files/environment/projects .secrets + +user +auth \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8a08e8e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "6.11.3" -sudo: required diff --git a/controller/github.js b/controller/github.js index c61e4e9..b2f4fde 100644 --- a/controller/github.js +++ b/controller/github.js @@ -265,7 +265,8 @@ function grabLocalLogin() { if (!git) { throw new Error(`There is no file at ${userFilePath}.`); } - return git.login; + // Failover to `login` for backward-compatibility + return git.username || git.login; } module.exports.grabLocalLogin = grabLocalLogin; diff --git a/controller/reporter.js b/controller/reporter.js index 9be4297..5c9c842 100644 --- a/controller/reporter.js +++ b/controller/reporter.js @@ -26,8 +26,8 @@ function report(testDir) { const runner = mocha.run(() => { process.stdout.write = stdoutWriteCopy; + res(runner.testResults); }); - res(runner.testResults); }); } diff --git a/controller/submit.js b/controller/submit.js index c1a125a..305dc48 100644 --- a/controller/submit.js +++ b/controller/submit.js @@ -75,7 +75,8 @@ function createGist({ project, stats }) { type: 'PROJECT', tests: stats.tests, passes: stats.passes, - failures: stats.failures + failures: stats.failures, + grade: Math.round(100 * (stats.passes / stats.tests)) }; let content = { @@ -91,6 +92,7 @@ function createGist({ project, stats }) { content = JSON.stringify(content); return new Promise(function (res, rej) { console.log(clc.yellow('Creating gist. . .')); + const cmd = createGistHelper( github.grabLocalLogin(), github.grabLocalAuthToken(), diff --git a/controller/test.js b/controller/test.js index dee4a18..5dd8163 100644 --- a/controller/test.js +++ b/controller/test.js @@ -170,15 +170,8 @@ function displayResults({ testResults }) { //part divided by the whole 3/4 = 75% //use math.round to round to the nearest whole percent let grade = Math.round(100 * (testResults.stats.passes / testResults.stats.tests)) - if(grade > 75) { - console.log( - clc.yellow(`You have passed ${grade}% of the test.`) - ) - } else { - console.log( - clc.red(`You have passed ${grade}% of the test.`) - ) - } + const clcMethod = grade > 75 ? clc.yellow : clc.red; + console.log(clcMethod(`You have passed ${grade}% of the test.`)); return { pass: false, grade: grade }; } diff --git a/package-lock.json b/package-lock.json index 05ecb85..6eeff64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -735,7 +735,7 @@ "cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", - "integrity": "sha512-TVF6svNzeQCOpjCqsy0/CSy8VgObG3wXusJ73xW2GbG5rGx7lC8zxDSURicsXI2UsGdi2L0QNRCi745/wUDvsA==" + "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=" }, "d": { "version": "1.0.1", @@ -1490,7 +1490,7 @@ "eyes": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", - "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" }, "fast-deep-equal": { "version": "1.1.0", @@ -3053,7 +3053,7 @@ "pkginfo": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", - "integrity": "sha512-8xCNE/aT/EXKenuMDZ+xTVwkT8gsoHN2z/Q29l80u0ppGEXVvsKRzNMbtKhg8LS8k1tJLAHHylf6p4VFmP6XUQ==" + "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=" }, "pluralize": { "version": "7.0.0", @@ -3207,7 +3207,7 @@ "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "requires": { "mute-stream": "~0.0.4" } @@ -3400,7 +3400,7 @@ "revalidator": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/revalidator/-/revalidator-0.1.8.tgz", - "integrity": "sha512-xcBILK2pA9oh4SiinPEZfhP8HfrB/ha+a2fTMyl7Om2WjlDVrOQy99N2MXXlUHqGJz4qEu2duXxHJjDWuK/0xg==" + "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=" }, "rimraf": { "version": "2.6.2", @@ -3705,7 +3705,7 @@ "stack-trace": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg==" + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" }, "statuses": { "version": "1.5.0", @@ -4037,7 +4037,7 @@ "utile": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/utile/-/utile-0.2.1.tgz", - "integrity": "sha512-ltfvuCJNa/JFOhKBBiQ9qDyyFwLstoMMO1ru0Yg/Mcl8dp1Z3IBaL7n+5dHpyma+d3lCogkgBQnWKtGxzNyqhg==", + "integrity": "sha1-kwyI6ZCY1iIINMNWy9mncFItkNc=", "requires": { "async": "~0.2.9", "deep-equal": "*", @@ -4050,7 +4050,7 @@ "async": { "version": "0.2.10", "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha512-eAkdoKxU6/LkKDBzLpT+t6Ff5EtfSF4wx1WfJiPEEV7WNLnDaRXk0oVysiEPm262roaachGexwUv94WhSgN5TQ==" + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=" } } },