test('@taskr/stylus', t => { t.plan(1); const taskr = create({ *foo(f) { t.true('stylus' in taskr.plugins, 'attach `stylus()` plugin to taskr'); } }); taskr.start('foo'); });
tape("styleFiles", (test) => { test.plan(4); fs.readdir("./style", function readdir(err, files) { test.ifError(err); files.forEach(function forFile(file) { test.ok(require(path.join("../style", file)), "Unable to load/parse."); }); test.end(); }); });
test('@taskr/unflow (sourceMap:`external`)', t => { t.plan(1); create({ *foo(f) { const tmp = tmpDir('tmp-4'); yield f.source(`${dir}/*.js`).unflow({ sourceMap:'external' }).target(tmp); const str = yield f.$.read(`${tmp}/foo.js`, 'utf8'); t.true(/sourceMappingURL=foo.js.map/.test(str), 'attach an `external` sourceMap link'); yield f.clear(tmp); } }).start('foo'); });
tape("configSingleYamlSync", (test) => { test.plan(1); const actual = markdownlint.readConfigSync( "./test/config/config-child.yaml", [ require("js-yaml").safeLoad ]); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); });
test('session unknown message', function (t) { t.plan(2) const session = new BrowserSession('abc', 30e3, '.') session.on('error', function (err) { t.is(err.message, 'Unknown message type') }) session.on('close', function () { t.pass('closed') }) session.resume() session.write({ type: 'foo' }) })
// Parses all Markdown files in all package dependencies tape("parseAllFiles", (test) => { test.plan(1); const options = { "files": globby.sync("**/*.{md,markdown}") }; markdownlint(options, (err) => { test.ifError(err); test.end(); }); });
tape("configBadJson", (test) => { test.plan(3); markdownlint.readConfig("./test/config/config-badjson.json", function callback(err, result) { test.ok(err, "Did not get an error for bad JSON."); test.ok(err instanceof Error, "Error not instance of Error."); test.ok(!result, "Got result for bad JSON."); test.end(); }); });
test('@taskr/rev (all)', t => { t.plan(3); const taskr = create({ *foo(f) { t.true('rev' in taskr.plugins, 'attach `rev()` plugin to taskr'); t.true('revManifest' in taskr.plugins, 'attach `revManifest()` plugin to taskr'); t.true('revReplace' in taskr.plugins, 'attach `revReplace()` plugin to taskr'); } }); taskr.start('foo'); });
tape("configBadChildFileSync", (test) => { test.plan(1); test.throws( function badChildFileCall() { markdownlint.readConfigSync("./test/config/config-badchildfile.json"); }, /ENOENT/, "Did not get correct exception for bad child file." ); test.end(); });
test('@taskr/postcss', t => { t.plan(2); const taskr = create({ *foo(f) { t.true('postcss' in f, 'attach `postcss()` plugin to internal task'); } }); t.true('postcss' in taskr.plugins, 'attach `postcss()` plugin to taskr'); taskr.start('foo'); });
tape("configAbsoluteSync", (test) => { test.plan(1); const actual = markdownlint.readConfigSync( path.join(__dirname, "config", "config-child.json")); const expected = require("./config/config-child.json"); test.deepEqual(actual, expected, "Config object not correct."); test.end(); });
test('@taskr/less', t => { t.plan(1); const taskr = create({ *foo(f) { t.true('less' in taskr.plugins, 'attach `less()` plugin to taskr'); } }); taskr.start('foo'); });
tape("configBadJsonSync", (test) => { test.plan(1); test.throws( function badJsonCall() { markdownlint.readConfigSync("./test/config/config-badjson.json"); }, /Unable to parse '[^']*'; Unexpected token \S+ in JSON at position \d+/, "Did not get correct exception for bad JSON." ); test.end(); });
test('@taskr/prettier', t => { t.plan(2); const taskr = create({ *foo(f) { t.true('prettier' in f, 'attach `prettier` to Task instance'); t.true('prettier' in taskr.plugins, 'attach `prettier` plugin to instance'); } }); taskr.start('foo'); });
test('@taskr/stylus', t => { t.plan(1); const taskr = create({ *foo(f) { t.true('stylus' in taskr.plugins, 'attach `stylus()` plugin to taskr'); } }); taskr.start('foo'); });