Skip to content

Commit 62040f7

Browse files
authored
Merge pull request #20856 from emberjs/kg-test-docs
2 parents 2e55d8f + 5794c9d commit 62040f7

File tree

3 files changed

+159
-3
lines changed

3 files changed

+159
-3
lines changed

tests/docs/coverage-test.js

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,71 @@ QUnit.module('Docs coverage', function (hooks) {
2323
let missing = setDifference(expectedItems, docsItems);
2424
assert.emptySet(
2525
missing,
26-
'If you have added new features, please update tests/docs/expected.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.'
26+
'The following classitems are missing. If you intentionally removed a public API method, please update tests/docs/expected.js. Otherwise, documentation is missing, incorrectly formatted, or in a directory that is not watched by yuidoc. All files containing documentation must have a yuidoc class declaration.'
2727
);
2828
});
2929

3030
QUnit.test('No extraneous classitems', function (assert) {
3131
let extraneous = setDifference(docsItems, expectedItems);
3232
assert.emptySet(
3333
extraneous,
34-
'If you intentionally removed a public API method, please update tests/docs/expected.js. Otherwise, documentation is missing, incorrectly formatted, or in a directory that is not watched by yuidoc. All files containing documentation must have a yuidoc class declaration.'
34+
'The following classitems are unexpected. If you have added new features, please update tests/docs/expected.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.'
35+
);
36+
});
37+
});
38+
39+
QUnit.module('classes', function (hooks) {
40+
let docsItems, expectedItems;
41+
hooks.before(function () {
42+
docsItems = new Set(
43+
Object.values(docs.classes)
44+
.filter((item) => item?.access !== 'private' && !item.name.includes('@'))
45+
.map((item) => item.name)
46+
);
47+
expectedItems = new Set(expected.classes);
48+
});
49+
50+
QUnit.test('No missing classes', function (assert) {
51+
let missing = setDifference(expectedItems, docsItems);
52+
assert.emptySet(
53+
missing,
54+
'The following classes are missing. If you intentionally removed a public API class, please update tests/docs/expected.js. Otherwise, documentation is missing, incorrectly formatted, or in a directory that is not watched by yuidoc. All files containing documentation must have a yuidoc class declaration.'
55+
);
56+
});
57+
58+
QUnit.test('No extraneous classes', function (assert) {
59+
let extraneous = setDifference(docsItems, expectedItems);
60+
assert.emptySet(
61+
extraneous,
62+
'The following classes are unexpected. If you have added new classes, please update tests/docs/expected.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.'
63+
);
64+
});
65+
});
66+
67+
QUnit.module('modules (packages)', function (hooks) {
68+
let docsItems, expectedItems;
69+
hooks.before(function () {
70+
docsItems = new Set(
71+
Object.values(docs.modules)
72+
.filter((item) => item?.access !== 'private')
73+
.map((item) => item.name)
74+
);
75+
expectedItems = new Set(expected.modules);
76+
});
77+
78+
QUnit.test('No missing modules (packages)', function (assert) {
79+
let missing = setDifference(expectedItems, docsItems);
80+
assert.emptySet(
81+
missing,
82+
'The following modules (packages) are missing. If you intentionally removed a public API module (package), please update tests/docs/expected.js. Otherwise, documentation is missing, incorrectly formatted, or in a directory that is not watched by yuidoc. All files containing documentation must have a yuidoc class declaration.'
83+
);
84+
});
85+
86+
QUnit.test('No extraneous modules (packages)', function (assert) {
87+
let extraneous = setDifference(docsItems, expectedItems);
88+
assert.emptySet(
89+
extraneous,
90+
'The following modules (packages) are unexpected. If you have added new modules (packages), please update tests/docs/expected.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.'
3591
);
3692
});
3793
});

tests/docs/expected.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,4 +546,103 @@ module.exports = {
546546
'wrapRecord',
547547
'yield',
548548
],
549+
classes: [
550+
'Application',
551+
'ApplicationInstance',
552+
'ApplicationInstance.BootOptions',
553+
'ArrayProxy',
554+
'Component',
555+
'ComputedProperty',
556+
'ContainerDebugAdapter',
557+
'CoreObject',
558+
'DataAdapter',
559+
'Ember',
560+
'Ember.Controller',
561+
'Ember.NativeArray',
562+
'Ember.Templates.components',
563+
'Ember.Templates.helpers',
564+
'Ember.Test',
565+
'Ember.Test.QUnitAdapter',
566+
'EmberArray',
567+
'EmberENV',
568+
'EmberObject',
569+
'EmberRouter',
570+
'Engine',
571+
'EngineInstance',
572+
'EventTarget',
573+
'Evented',
574+
'FEATURES',
575+
'Factory',
576+
'FactoryManager',
577+
'FullName',
578+
'HashLocation',
579+
'Helper',
580+
'HistoryLocation',
581+
'Location',
582+
'Mixin',
583+
'MutableArray',
584+
'Namespace',
585+
'NoneLocation',
586+
'ObjectProxy',
587+
'Observable',
588+
'Owner',
589+
'Promise',
590+
'PromiseProxyMixin',
591+
'RegisterOptions',
592+
'Renderer',
593+
'Resolver',
594+
'Route',
595+
'RouteInfo',
596+
'RouteInfoWithAttributes',
597+
'RouterService',
598+
'SafeString',
599+
'Service',
600+
'TestAdapter',
601+
'Transition',
602+
'rsvp',
603+
],
604+
modules: [
605+
'@ember/application',
606+
'@ember/application/namespace',
607+
'@ember/array',
608+
'@ember/array/proxy',
609+
'@ember/canary-features',
610+
'@ember/component',
611+
'@ember/component/template-only',
612+
'@ember/controller',
613+
'@ember/debug',
614+
'@ember/debug/container-debug-adapter',
615+
'@ember/debug/data-adapter',
616+
'@ember/destroyable',
617+
'@ember/engine',
618+
'@ember/helper',
619+
'@ember/object',
620+
'@ember/object/core',
621+
'@ember/object/evented',
622+
'@ember/object/mixin',
623+
'@ember/object/observable',
624+
'@ember/object/promise-proxy-mixin',
625+
'@ember/object/proxy',
626+
'@ember/owner',
627+
'@ember/renderer',
628+
'@ember/routing',
629+
'@ember/routing/hash-location',
630+
'@ember/routing/history-location',
631+
'@ember/routing/location',
632+
'@ember/routing/none-location',
633+
'@ember/routing/route',
634+
'@ember/routing/route-info',
635+
'@ember/routing/router',
636+
'@ember/routing/router-service',
637+
'@ember/routing/transition',
638+
'@ember/runloop',
639+
'@ember/service',
640+
'@ember/template',
641+
'@ember/test',
642+
'@ember/utils',
643+
'@glimmer/component',
644+
'@glimmer/tracking',
645+
'@glimmer/tracking/primitives/cache',
646+
'rsvp',
647+
],
549648
};

yuidoc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"packages/ember-testing/lib",
1111
"node_modules/rsvp/lib",
1212
"packages/@ember",
13-
"packages/@ember/-internals"
13+
"packages/@ember/-internals",
14+
"packages/@glimmer"
1415
],
1516
"exclude": "vendor",
1617
"outdir": "docs",

0 commit comments

Comments
 (0)