Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs/test
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-03-30 18:32:22 +0300
committerGitHub <noreply@github.com>2022-03-30 18:32:22 +0300
commita59fd2cb863245fce56f96c90ac854e62c5c4d6f (patch)
treef1421497144abae5a2d0190f9d06adc3e4b5da36 /docs/test
parentcc0a2ec9999b956ea654deaf68fd49ae4bf1a1c0 (diff)
deps: @npmcli/template-oss@3.2.2 (#4639)
- add some basic tests for docs - make dockhand script work on windows - cleanup main CI to match template-oss - add a git status check for cli ci tests - use resetdeps for ci steps
Diffstat (limited to 'docs/test')
-rw-r--r--docs/test/index.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/docs/test/index.js b/docs/test/index.js
index ee0fee2b7..fab9748a3 100644
--- a/docs/test/index.js
+++ b/docs/test/index.js
@@ -1,3 +1,37 @@
const t = require('tap')
+const spawn = require('@npmcli/promise-spawn')
+const fs = require('@npmcli/fs')
+const { resolve, join } = require('path')
+const which = require('which').sync
-t.ok(1)
+const cwd = resolve(__dirname, '..')
+const output = join(cwd, 'output')
+
+const rmOutput = () => fs.rm(output, { recursive: true, force: true }).catch(() => {})
+
+const spawnNpm = (...args) => {
+ // remove npm config when spawning so config set by test commands don't interfere
+ const env = Object.entries(process.env)
+ .filter(([k]) => k.toLowerCase() !== 'npm_config_ignore_scripts')
+
+ return spawn(which('npm'), args, {
+ env: Object.fromEntries(env),
+ stdioString: true,
+ cwd,
+ })
+}
+
+t.before(() => spawnNpm('rebuild', 'cmark-gfm'))
+t.beforeEach(() => rmOutput())
+
+t.test('docs', async (t) => {
+ t.rejects(() => fs.stat(output))
+ const docs = await spawnNpm('run', 'build')
+ t.equal(docs.code, 0)
+ t.ok((await fs.stat(output)).isDirectory())
+})
+
+t.test('files used by documention repo', async (t) => {
+ t.ok((await fs.stat(join(cwd, 'content'))).isDirectory())
+ t.ok((await fs.stat(join(cwd, 'nav.yml'))).isFile())
+})