From 18f6225d1784c51689d813374b5fc70e9f3c4311 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 24 Aug 2018 16:06:01 -0400 Subject: [PATCH 1/8] Test for API docs coverage This adds a new test to the code-quality suite that ensure we are exporting the expected set of items into the API docs. We have repeatedly lost parts of the API docs without noticing, so I believe this test is worth the extra friction for people who are intentionally adding or deleting public APIs. --- .eslintignore | 2 +- .eslintrc.js | 1 + .gitignore | 2 +- bin/run-tests.js | 1 + tests/docs/coverage-test.js | 65 +++++ tests/docs/expected.js | 561 ++++++++++++++++++++++++++++++++++++ 6 files changed, 630 insertions(+), 2 deletions(-) create mode 100644 tests/docs/coverage-test.js create mode 100644 tests/docs/expected.js diff --git a/.eslintignore b/.eslintignore index c74edf369c8..2003cec41a0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,5 +1,5 @@ blueprints/*/*files/**/*.js node-tests/fixtures/**/*.js -docs/ +/docs/ dist/ tmp/ diff --git a/.eslintrc.js b/.eslintrc.js index 1bcdf4d9518..9ba8cc9a672 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -111,6 +111,7 @@ module.exports = { 'tests/node/**/*.js', 'blueprints/**/*.js', 'bin/**/*.js', + 'tests/docs/*.js', 'config/**/*.js', 'lib/**/*.js', 'server/**/*.js', diff --git a/.gitignore b/.gitignore index b66c9f446b8..470f0c4920f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ assets/bpm_libs.js assets/bpm_styles.css coverage dist -docs +/docs lib/*/tests/all.js lib/*/tests/qunit* lib/bundler/man diff --git a/bin/run-tests.js b/bin/run-tests.js index 5efcd082a0b..abeb6ad3208 100755 --- a/bin/run-tests.js +++ b/bin/run-tests.js @@ -140,6 +140,7 @@ function codeQualityChecks() { runChecker('node', [require.resolve('typescript/bin/tsc'), '--noEmit']), runChecker('node', [require.resolve('tslint/bin/tslint'), '-p', 'tsconfig.json']), runChecker('node', [require.resolve('eslint/bin/eslint'), '.']), + runChecker('node', [require.resolve('qunit/bin/qunit'), 'tests/docs/coverage-test.js']), ]; return Promise.all(checkers).then(function(results) { results.forEach(result => { diff --git a/tests/docs/coverage-test.js b/tests/docs/coverage-test.js new file mode 100644 index 00000000000..a7d0130d30c --- /dev/null +++ b/tests/docs/coverage-test.js @@ -0,0 +1,65 @@ +/* eslint-disable no-console */ +'use strict'; + +const QUnit = require('qunit'); +const test = QUnit.test; +const path = require('path'); + +QUnit.module('Docs coverage', function(hooks) { + let docs, expected; + hooks.before(function() { + if (!process.env.REUSE_DOCS) { + buildDocs(); + } + docs = require(path.join(__dirname, '../../docs/data.json')); + expected = require('./expected'); + }); + + QUnit.module('classitems', function(hooks) { + let docsItems, expectedItems; + hooks.before(function() { + docsItems = new Set(docs.classitems.map(item => item.name).filter(Boolean)); + expectedItems = new Set(expected.classitems); + }); + + test('No missing classitems', function(assert) { + let missing = setDifference(expectedItems, docsItems); + assert.emptySet( + missing, + 'If you really intended to remove these from the API docs, update tests/docs/expected.js to match.' + ); + }); + + test('No extraneous classitems', function(assert) { + let extraneous = setDifference(docsItems, expectedItems); + assert.emptySet( + extraneous, + 'If you really intended to add these to the API docs, update tests/docs/expected.js to match.' + ); + }); + }); +}); + +function buildDocs() { + let child = require('child_process'); + child.execFileSync('node', [require.resolve('ember-cli/bin/ember'), 'ember-cli-yuidoc'], { + stdio: 'pipe', + }); +} + +function setDifference(setA, setB) { + let difference = new Set(setA); + for (var elem of setB) { + difference.delete(elem); + } + return difference; +} + +QUnit.assert.emptySet = function assertEmptySet(value, message) { + this.pushResult({ + result: value.size === 0, + actual: Array.from(value).sort(), + expected: [], + message: message, + }); +}; diff --git a/tests/docs/expected.js b/tests/docs/expected.js new file mode 100644 index 00000000000..7cb2db1ed46 --- /dev/null +++ b/tests/docs/expected.js @@ -0,0 +1,561 @@ +module.exports = { + classitems: [ + '$', + '@each', + 'A', + 'GUID_KEY', + 'GUID_PREFIX', + '[]', + '__container__', + '_activeQPChanged', + '_applicationInstances', + '_deserializeQueryParam', + '_deserializeQueryParams', + '_fullyScopeQueryParams', + '_getHashPath', + '_getObjectsOnNamespaces', + '_getQPMeta', + '_globalsMode', + '_helpers', + '_hydrateUnsuppliedQueryParams', + '_initializersRan', + '_injections', + '_invoke', + '_lazyInjections', + '_logLookup', + '_names', + '_normalizeCache', + '_onLookup', + '_options', + '_optionsForQueryParam', + '_prepareForGlobalsMode', + '_prepareQueryParams', + '_pruneDefaultQueryParamValues', + '_qp', + '_qpChanged', + '_qpDelegate', + '_queryParamsFor', + '_renderMode', + '_reset', + '_resolveCache', + '_scheduledDestroy', + '_serializeQueryParam', + '_serializeQueryParams', + '_setRouteName', + '_stashNames', + '_typeInjections', + '_typeOptions', + '_unwatchInstance', + '_updatingQPChanged', + '_watchInstance', + 'abort', + 'acceptsModelName', + 'action', + 'actions', + 'activate', + 'active', + 'activeClass', + 'adapter', + 'add', + 'addArrayObserver', + 'addListener', + 'addObject', + 'addObjects', + 'addObserver', + 'advanceReadiness', + 'afterModel', + 'alias', + 'aliasMethod', + 'all', + 'allSettled', + 'and', + 'any', + 'append', + 'appendTo', + 'application', + 'apply', + 'ariaRole', + 'arrangedContent', + 'arrayContentDidChange', + 'arrayContentWillChange', + 'assert', + 'assign', + 'asyncEnd', + 'asyncStart', + 'attributeBindings', + 'attributeLimit', + 'autoboot', + 'beforeModel', + 'begin', + 'beginPropertyChanges', + 'bind', + 'bool', + 'boot', + 'bubbles', + 'buildChildEngineInstance', + 'buildInstance', + 'buildRegistry', + 'cache', + 'cacheFor', + 'camelize', + 'canCatalogEntriesByType', + 'canInvoke', + 'cancel', + 'cancelRouterSetup', + 'capitalize', + 'catalogEntriesByType', + 'catch', + 'changeProperties', + 'checkWaiters', + 'childViews', + 'classNameBindings', + 'classNames', + 'classify', + 'clear', + 'click', + 'cloneParentDependencies', + 'collect', + 'columnsForType', + 'compact', + 'compare', + 'component', + 'compute', + 'computed', + 'concat', + 'concatenatedProperties', + 'container', + 'containerDebugAdapter', + 'content', + 'contextDidChange', + 'controller', + 'controllerFor', + 'controllerName', + 'copy', + 'create', + 'current-when', + 'currentPath', + 'currentRouteName', + 'currentURL', + 'customEvents', + 'dasherize', + 'data', + 'deactivate', + 'debounce', + 'debug', + 'decamelize', + 'decrementProperty', + 'defer', + 'deferReadiness', + 'defineProperty', + 'delete', + 'denodeify', + 'deprecate', + 'deprecateFunc', + 'deprecateProperty', + 'deprecatingAlias', + 'describe', + 'deserialize', + 'deserializeQueryParam', + 'destroy', + 'detect', + 'didBecomeReady', + 'didInsertElement', + 'didReceiveAttrs', + 'didRender', + 'didTransition', + 'didUpdate', + 'didUpdateAttrs', + 'disabled', + 'disabledClass', + 'disconnectOutlet', + 'document', + 'domReady', + 'each', + 'each-in', + 'eachComputedProperty', + 'element', + 'elementId', + 'empty', + 'end', + 'endPropertyChanges', + 'engine', + 'ensureInitializers', + 'enter', + 'equal', + 'error', + 'eventDispatcher', + 'eventName', + 'events', + 'every', + 'exception', + 'exit', + 'expandLocalLookup', + 'expandProperties', + 'extend', + 'factoryFor', + 'fallback', + 'fillIn', + 'filter', + 'filterBy', + 'finally', + 'find', + 'findBy', + 'findElementInParentElement', + 'findModel', + 'findWithAssert', + 'firstObject', + 'focusIn', + 'focusOut', + 'followRedirects', + 'forEach', + 'formatURL', + 'fullRouteName', + 'generateController', + 'generateControllerFactory', + 'generateGuid', + 'get', + 'getChildViews', + 'getEach', + 'getEngineParent', + 'getFilters', + 'getHash', + 'getModelTypes', + 'getProperties', + 'getRecordColor', + 'getRecordColumnValues', + 'getRecordFilterValues', + 'getRecordKeywords', + 'getRecords', + 'getRootViews', + 'getState', + 'getURL', + 'getViewBoundingClientRect', + 'getViewBounds', + 'getViewClientRects', + 'getViewElement', + 'getViewId', + 'getViewRange', + 'getWithDefault', + 'global', + 'gt', + 'gte', + 'guidFor', + 'handleEvent', + 'handleURL', + 'has', + 'hasArrayObservers', + 'hasListeners', + 'hasObserverFor', + 'hasRegistration', + 'hasRoute', + 'hash', + 'hashSettled', + 'helper', + 'helperContainer', + 'history', + 'href', + 'htmlSafe', + 'if', + 'includes', + 'incrementProperty', + 'indexOf', + 'info', + 'init', + 'initState', + 'initializer', + 'inject', + 'injectTestHelpers', + 'injection', + 'input', + 'insertAt', + 'insertNewline', + 'inspect', + 'instanceInitializer', + 'instrument', + 'intermediateTransitionTo', + 'intersect', + 'invoke', + 'isActive', + 'isActiveIntent', + 'isAny', + 'isArray', + 'isBlank', + 'isBrowser', + 'isDestroyed', + 'isDestroying', + 'isEmpty', + 'isEnabled', + 'isEqual', + 'isEvery', + 'isFulfilled', + 'isHTMLSafe', + 'isInteractive', + 'isNone', + 'isObject', + 'isPending', + 'isPresent', + 'isRejected', + 'isSettled', + 'isVisible', + 'jQuery', + 'join', + 'keyDown', + 'keyEvent', + 'keyPress', + 'keyUp', + 'knownForType', + 'lastIndexOf', + 'lastObject', + 'later', + 'layout', + 'layoutName', + 'length', + 'let', + 'link-to', + 'loading', + 'loadingClass', + 'loadingHref', + 'loc', + 'location', + 'log', + 'lookup', + 'lookupDescription', + 'lt', + 'lte', + 'makeArray', + 'makeToString', + 'map', + 'mapBy', + 'match', + 'matches', + 'max', + 'merge', + 'mergedProperties', + 'meta', + 'metaForProperty', + 'method', + 'min', + 'mixin', + 'model', + 'modelFor', + 'mount', + 'mut', + 'namespace', + 'nearestOfType', + 'nearestWithProperty', + 'next', + 'none', + 'normalize', + 'normalizeFullName', + 'not', + 'notEmpty', + 'notifyPropertyChange', + 'objectAt', + 'objectAtContent', + 'objectsAt', + 'observeModelType', + 'observer', + 'observerRecord', + 'observes', + 'off', + 'on', + 'onInjectHelpers', + 'onLoad', + 'onUpdateURL', + 'once', + 'one', + 'oneWay', + 'options', + 'optionsForType', + 'or', + 'originalMethods', + 'outlet', + 'ownerInjection', + 'paramsFor', + 'parentView', + 'parentViewDidChange', + 'parseName', + 'pattern', + 'pauseTest', + 'popObject', + 'positionalParams', + 'promise', + 'property', + 'propertyDidChange', + 'propertyWillChange', + 'pushObject', + 'pushObjects', + 'pushState', + 'query-params', + 'queryParams', + 'queryParamsDidChange', + 'queues', + 'race', + 'readDOMAttr', + 'readOnly', + 'readonly', + 'reads', + 'ready', + 'reason', + 'recompute', + 'redirect', + 'reduce', + 'refresh', + 'register', + 'registerAsyncHelper', + 'registerDeprecationHandler', + 'registerHelper', + 'registerOptions', + 'registerOptionsForType', + 'registerWaiter', + 'registerWarnHandler', + 'registeredActions', + 'registeredOption', + 'registeredOptions', + 'registeredOptionsForType', + 'registrations', + 'registry', + 'reject', + 'rejectBy', + 'rel', + 'releaseMethods', + 'removeArrayObserver', + 'removeAt', + 'removeListener', + 'removeObject', + 'removeObjects', + 'removeObserver', + 'removeTestHelpers', + 'render', + 'renderTemplate', + 'reopen', + 'reopenClass', + 'replace', + 'replaceContent', + 'replaceRoute', + 'replaceState', + 'replaceURL', + 'replaceWith', + 'rerender', + 'reset', + 'resetController', + 'resolve', + 'resolveController', + 'resolveHelper', + 'resolveModel', + 'resolveOther', + 'resolveRegistration', + 'resolveRoute', + 'resolveTemplate', + 'resolveView', + 'resolver', + 'resolverFor', + 'resumeTest', + 'rethrow', + 'retry', + 'reverseObjects', + 'rootElement', + 'rootURL', + 'routeName', + 'run', + 'runInDebug', + 'runInitializers', + 'runInstanceInitializers', + 'runLoadHooks', + 'schedule', + 'scheduleOnce', + 'send', + 'sendAction', + 'sendEvent', + 'serialize', + 'serializeQueryParam', + 'serializeQueryParamKey', + 'set', + 'setDiff', + 'setEach', + 'setEngineParent', + 'setObjects', + 'setProperties', + 'setURL', + 'setup', + 'setupController', + 'setupForTesting', + 'setupHandler', + 'setupRegistry', + 'shiftObject', + 'shouldRender', + 'size', + 'slice', + 'sort', + 'sortBy', + 'startRouting', + 'store', + 'subscribe', + 'sum', + 'tabindex', + 'tagName', + 'target', + 'teardownViews', + 'templateName', + 'testCheckboxClick', + 'testHelpers', + 'testing', + 'textarea', + 'then', + 'throttle', + 'title', + 'toArray', + 'toString', + 'toggleProperty', + 'transitionTo', + 'transitionToRoute', + 'translateToContainerFullname', + 'trigger', + 'triggerAction', + 'triggerEvent', + 'tryInvoke', + 'trySet', + 'type', + 'typeInjection', + 'typeOf', + 'unbound', + 'underscore', + 'union', + 'uniq', + 'uniqBy', + 'unless', + 'unregister', + 'unregisterHelper', + 'unregisterWaiter', + 'unshiftObject', + 'unshiftObjects', + 'unsubscribe', + 'unwatch', + 'url', + 'urlFor', + 'useRouterNaming', + 'userAgent', + 'validationCache', + 'value', + 'visit', + 'volatile', + 'w', + 'wait', + 'waitForDOMReady', + 'warn', + 'watch', + 'watchModelTypes', + 'watchRecords', + 'willClearRender', + 'willDestroy', + 'willDestroyElement', + 'willInsertElement', + 'willRender', + 'willTransition', + 'willUpdate', + 'without', + 'wrap', + 'wrapModelType', + 'wrapRecord', + ], +}; From 6416d56ff3c64a05bead27fd348ff187ceb52a43 Mon Sep 17 00:00:00 2001 From: Jen Weber Date: Sat, 25 Aug 2018 13:39:08 -0400 Subject: [PATCH 2/8] add command to run yuidoc tests --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 013287e40e4..c5f2bca7828 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,8 @@ "test:blueprints-debugger": "node --inspect-brk node-tests/nodetest-runner.js", "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", - "test:testem": "testem -f testem.dist.js" + "test:testem": "testem -f testem.dist.js", + "test:docs": "ember ember-cli-yuidoc && node bin/yuidoc-tests.js" }, "dependencies": { "broccoli-funnel": "^2.0.1", From 9343f34813538dc20f35f139c0aa5ff9f68df483 Mon Sep 17 00:00:00 2001 From: Jen Weber Date: Sat, 25 Aug 2018 14:50:30 -0400 Subject: [PATCH 3/8] add simple test for missing yuidocs --- bin/yuidoc-tests.js | 51 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 bin/yuidoc-tests.js diff --git a/bin/yuidoc-tests.js b/bin/yuidoc-tests.js new file mode 100644 index 00000000000..a18850fdc93 --- /dev/null +++ b/bin/yuidoc-tests.js @@ -0,0 +1,51 @@ +'use strict'; + +/** + * This tests whether there is a change in the number of modules, classes, or properties that yuidoc sees. It is not a guarantee that all documentation will show up in the Ember API docs app, but it checks for major regressions. + */ + +const fs = require('fs'); +const docData = JSON.parse(fs.readFileSync('./docs/data.json', 'utf8')); + +const expectedCounts = [ + { + category: 'files', + count: 180, + }, + { + category: 'modules', + count: 21, + }, + { + category: 'classes', + count: 109, + }, + { + category: 'classitems', + count: 811, + }, +]; + +const failedTestMessage = function(expectedCount, actualCount, category) { + let report = `${expectedCount} ${category} documentation entries expected, ${actualCount} present. \n`; + if (expectedCount < actualCount) { + return ( + report + + 'If you have added new features, please increment the expectedCounts in the yuidoc-tests.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.' + ); + } else { + return ( + report + + '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.' + ); + } +}; + +expectedCounts.forEach(function(expected) { + QUnit.test(expected.category, function(assert) { + const docsToCount = docData[expected.category]; + const actualCount = Object.keys(docsToCount).length; + let message = failedTestMessage(expected.count, actualCount, expected.category); + assert.ok(actualCount === expected.count, message); + }); +}); diff --git a/package.json b/package.json index c5f2bca7828..9b230a87426 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", "test:testem": "testem -f testem.dist.js", - "test:docs": "ember ember-cli-yuidoc && node bin/yuidoc-tests.js" + "test:docs": "qunit bin/yuidoc-tests.js" }, "dependencies": { "broccoli-funnel": "^2.0.1", From 3fbc97be7233f79a4edb0abc5a268511f746d063 Mon Sep 17 00:00:00 2001 From: Jen Weber Date: Sat, 25 Aug 2018 15:04:46 -0400 Subject: [PATCH 4/8] fix tests totals --- bin/yuidoc-tests.js | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/yuidoc-tests.js b/bin/yuidoc-tests.js index a18850fdc93..efb682f1c84 100644 --- a/bin/yuidoc-tests.js +++ b/bin/yuidoc-tests.js @@ -10,7 +10,7 @@ const docData = JSON.parse(fs.readFileSync('./docs/data.json', 'utf8')); const expectedCounts = [ { category: 'files', - count: 180, + count: 178, }, { category: 'modules', @@ -18,11 +18,11 @@ const expectedCounts = [ }, { category: 'classes', - count: 109, + count: 101, }, { category: 'classitems', - count: 811, + count: 781, }, ]; @@ -42,7 +42,7 @@ const failedTestMessage = function(expectedCount, actualCount, category) { }; expectedCounts.forEach(function(expected) { - QUnit.test(expected.category, function(assert) { + QUnit.test(expected.category + ' docs', function(assert) { const docsToCount = docData[expected.category]; const actualCount = Object.keys(docsToCount).length; let message = failedTestMessage(expected.count, actualCount, expected.category); diff --git a/package.json b/package.json index 9b230a87426..c3839d5e738 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", "test:testem": "testem -f testem.dist.js", - "test:docs": "qunit bin/yuidoc-tests.js" + "test:docs": "ember ember-cli-yuidoc qunit bin/yuidoc-tests.js" }, "dependencies": { "broccoli-funnel": "^2.0.1", From 46ab48267cb7b3001baeaf6459782ba1b97fb719 Mon Sep 17 00:00:00 2001 From: Jen Weber Date: Sat, 25 Aug 2018 15:16:16 -0400 Subject: [PATCH 5/8] fix test running command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c3839d5e738..fbda2e5806c 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", "test:testem": "testem -f testem.dist.js", - "test:docs": "ember ember-cli-yuidoc qunit bin/yuidoc-tests.js" + "test:docs": "ember ember-cli-yuidoc && qunit bin/yuidoc-tests.js" }, "dependencies": { "broccoli-funnel": "^2.0.1", From dd6954080a6c6592c421ea0d881c29c58c6797f1 Mon Sep 17 00:00:00 2001 From: Jen Weber Date: Sat, 25 Aug 2018 15:41:01 -0400 Subject: [PATCH 6/8] resolve QUnit is undefined linting --- .eslintrc.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 9ba8cc9a672..55edc68269d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -162,7 +162,10 @@ module.exports = { }, }, { - files: [ 'tests/node/**/*.js' ], + files: [ + 'tests/node/**/*.js', + 'bin/yuidoc-tests.js' + ], env: { qunit: true From 5e8ab3c50ff5253cbdeae594481a18c3c69adeb2 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 26 Aug 2018 12:26:58 -0400 Subject: [PATCH 7/8] combine with better messages Taking better messages from PR 16912. --- .eslintrc.js | 5 +--- bin/yuidoc-tests.js | 51 ------------------------------------- package.json | 3 +-- tests/docs/coverage-test.js | 4 +-- 4 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 bin/yuidoc-tests.js diff --git a/.eslintrc.js b/.eslintrc.js index 55edc68269d..9ba8cc9a672 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -162,10 +162,7 @@ module.exports = { }, }, { - files: [ - 'tests/node/**/*.js', - 'bin/yuidoc-tests.js' - ], + files: [ 'tests/node/**/*.js' ], env: { qunit: true diff --git a/bin/yuidoc-tests.js b/bin/yuidoc-tests.js deleted file mode 100644 index efb682f1c84..00000000000 --- a/bin/yuidoc-tests.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -/** - * This tests whether there is a change in the number of modules, classes, or properties that yuidoc sees. It is not a guarantee that all documentation will show up in the Ember API docs app, but it checks for major regressions. - */ - -const fs = require('fs'); -const docData = JSON.parse(fs.readFileSync('./docs/data.json', 'utf8')); - -const expectedCounts = [ - { - category: 'files', - count: 178, - }, - { - category: 'modules', - count: 21, - }, - { - category: 'classes', - count: 101, - }, - { - category: 'classitems', - count: 781, - }, -]; - -const failedTestMessage = function(expectedCount, actualCount, category) { - let report = `${expectedCount} ${category} documentation entries expected, ${actualCount} present. \n`; - if (expectedCount < actualCount) { - return ( - report + - 'If you have added new features, please increment the expectedCounts in the yuidoc-tests.js and confirm that any public properties are marked both @public and @static to be included in the Ember API Docs viewer.' - ); - } else { - return ( - report + - '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.' - ); - } -}; - -expectedCounts.forEach(function(expected) { - QUnit.test(expected.category + ' docs', function(assert) { - const docsToCount = docData[expected.category]; - const actualCount = Object.keys(docsToCount).length; - let message = failedTestMessage(expected.count, actualCount, expected.category); - assert.ok(actualCount === expected.count, message); - }); -}); diff --git a/package.json b/package.json index fbda2e5806c..013287e40e4 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,7 @@ "test:blueprints-debugger": "node --inspect-brk node-tests/nodetest-runner.js", "test:node": "qunit tests/**/*-test.js", "test:browserstack": "node bin/run-browserstack-tests.js", - "test:testem": "testem -f testem.dist.js", - "test:docs": "ember ember-cli-yuidoc && qunit bin/yuidoc-tests.js" + "test:testem": "testem -f testem.dist.js" }, "dependencies": { "broccoli-funnel": "^2.0.1", diff --git a/tests/docs/coverage-test.js b/tests/docs/coverage-test.js index a7d0130d30c..31c76fe2da6 100644 --- a/tests/docs/coverage-test.js +++ b/tests/docs/coverage-test.js @@ -26,7 +26,7 @@ QUnit.module('Docs coverage', function(hooks) { let missing = setDifference(expectedItems, docsItems); assert.emptySet( missing, - 'If you really intended to remove these from the API docs, update tests/docs/expected.js to match.' + '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.' ); }); @@ -34,7 +34,7 @@ QUnit.module('Docs coverage', function(hooks) { let extraneous = setDifference(docsItems, expectedItems); assert.emptySet( extraneous, - 'If you really intended to add these to the API docs, update tests/docs/expected.js to match.' + 'If you intentionally removed a public API method, please udpate 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.' ); }); }); From 0ded32325d236e4fb8d2236dc9a288ce410aeae6 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Sun, 14 Oct 2018 11:29:27 +0200 Subject: [PATCH 8/8] update to match current code --- tests/docs/expected.js | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/docs/expected.js b/tests/docs/expected.js index 7cb2db1ed46..ad715322a30 100644 --- a/tests/docs/expected.js +++ b/tests/docs/expected.js @@ -3,9 +3,15 @@ module.exports = { '$', '@each', 'A', + 'EXTEND_PROTOTYPES', 'GUID_KEY', 'GUID_PREFIX', + 'LOG_STACKTRACE_ON_DEPRECATION', + 'LOG_VERSION', '[]', + '_APPLICATION_TEMPLATE_WRAPPER', + '_JQUERY_INTEGRATION', + '_TEMPLATE_ONLY_GLIMMER_COMPONENTS', '__container__', '_activeQPChanged', '_applicationInstances', @@ -20,6 +26,7 @@ module.exports = { '_hydrateUnsuppliedQueryParams', '_initializersRan', '_injections', + '_internalReset', '_invoke', '_lazyInjections', '_logLookup', @@ -36,7 +43,6 @@ module.exports = { '_qpDelegate', '_queryParamsFor', '_renderMode', - '_reset', '_resolveCache', '_scheduledDestroy', '_serializeQueryParam', @@ -76,6 +82,7 @@ module.exports = { 'apply', 'ariaRole', 'arrangedContent', + 'array', 'arrayContentDidChange', 'arrayContentWillChange', 'assert', @@ -84,6 +91,7 @@ module.exports = { 'asyncStart', 'attributeBindings', 'attributeLimit', + 'attributes', 'autoboot', 'beforeModel', 'begin', @@ -134,6 +142,7 @@ module.exports = { 'create', 'current-when', 'currentPath', + 'currentRoute', 'currentRouteName', 'currentURL', 'customEvents', @@ -142,18 +151,21 @@ module.exports = { 'deactivate', 'debounce', 'debug', + 'debugger', 'decamelize', 'decrementProperty', 'defer', 'deferReadiness', 'defineProperty', 'delete', + 'deleteMeta', 'denodeify', 'deprecate', 'deprecateFunc', 'deprecateProperty', 'deprecatingAlias', 'describe', + 'descriptorFor', 'deserialize', 'deserializeQueryParam', 'destroy', @@ -209,6 +221,7 @@ module.exports = { 'followRedirects', 'forEach', 'formatURL', + 'from', 'fullRouteName', 'generateController', 'generateControllerFactory', @@ -220,6 +233,7 @@ module.exports = { 'getFilters', 'getHash', 'getModelTypes', + 'getOwner', 'getProperties', 'getRecordColor', 'getRecordColumnValues', @@ -316,6 +330,7 @@ module.exports = { 'loadingClass', 'loadingHref', 'loc', + 'localName', 'location', 'log', 'lookup', @@ -340,6 +355,7 @@ module.exports = { 'modelFor', 'mount', 'mut', + 'name', 'namespace', 'nearestOfType', 'nearestWithProperty', @@ -371,10 +387,14 @@ module.exports = { 'originalMethods', 'outlet', 'ownerInjection', + 'paramNames', + 'params', 'paramsFor', + 'parent', 'parentView', 'parentViewDidChange', 'parseName', + 'partial', 'pattern', 'pauseTest', 'popObject', @@ -397,6 +417,8 @@ module.exports = { 'reads', 'ready', 'reason', + 'recognize', + 'recognizeAndLoad', 'recompute', 'redirect', 'reduce', @@ -456,7 +478,9 @@ module.exports = { 'reverseObjects', 'rootElement', 'rootURL', + 'routeDidChange', 'routeName', + 'routeWillChange', 'run', 'runInDebug', 'runInitializers', @@ -475,6 +499,7 @@ module.exports = { 'setEach', 'setEngineParent', 'setObjects', + 'setOwner', 'setProperties', 'setURL', 'setup', @@ -504,6 +529,7 @@ module.exports = { 'then', 'throttle', 'title', + 'to', 'toArray', 'toString', 'toggleProperty', @@ -553,9 +579,11 @@ module.exports = { 'willRender', 'willTransition', 'willUpdate', + 'with', 'without', 'wrap', 'wrapModelType', 'wrapRecord', + 'yield', ], };