File tree Expand file tree Collapse file tree 4 files changed +482
-15
lines changed
Expand file tree Collapse file tree 4 files changed +482
-15
lines changed Original file line number Diff line number Diff line change @@ -54,5 +54,19 @@ module.exports = {
5454 files : [ 'tests/**/*-test.{js,ts}' ] ,
5555 extends : [ 'plugin:qunit/recommended' ] ,
5656 } ,
57+ {
58+ // mocha tests
59+ files : [ 'node-tests/**/*.mjs' ] ,
60+ env : {
61+ browser : false ,
62+ node : true ,
63+ mocha : true ,
64+ } ,
65+ plugins : [ 'node' ] ,
66+ extends : [ 'plugin:node/recommended' ] ,
67+ rules : {
68+ 'node/no-unpublished-import' : 'off' ,
69+ } ,
70+ } ,
5771 ] ,
5872} ;
Original file line number Diff line number Diff line change 1+ import { readFileSync } from 'fs' ;
2+ import walkSync from 'walk-sync' ;
3+ import { join , basename } from 'path' ;
4+ import yamlFront from 'yaml-front-matter' ;
5+
6+ const markdownFilenames = walkSync ( 'content' , { globs : [ '**/*.md' ] } ) ;
7+
8+ console . log ( markdownFilenames ) ;
9+
10+ describe ( 'Json Tests' , function ( ) {
11+ markdownFilenames . forEach ( ( file ) => {
12+ it ( `${ file } is ok` , function ( ) {
13+ let contents = readFileSync ( join ( 'content' , file ) , 'utf8' ) ;
14+ contents = yamlFront . loadFront ( contents ) ;
15+
16+ if ( contents . id ) {
17+ throw new Error (
18+ `You can't define an ID for a deprecation. If you need an ID that is different from the file name then use displayId`
19+ ) ;
20+ }
21+
22+ if ( contents . displayId && contents . displayId === basename ( file , '.md' ) ) {
23+ throw new Error (
24+ `You don't need to define a displayId if it's the same as the file name`
25+ ) ;
26+ }
27+ } ) ;
28+ } ) ;
29+ } ) ;
You can’t perform that action at this time.
0 commit comments