Bump node version, add tests and code coverage#26
Conversation
73cef77 to
148dc84
Compare
Jwaegebaert
left a comment
There was a problem hiding this comment.
Awesome work with this PR @garrytrinder. I'm no master of GitHub actions but at first glance, they look all right. I've left a few suggestions but those are mostly cosmetic 😉
| @@ -1,23 +1,30 @@ | |||
| name: 'CLI for Microsoft 365 Deploy App' | |||
| description: 'Deploy an app using CLI for Microsoft 365' | |||
| name: "CLI for Microsoft 365 Deploy App" | |||
There was a problem hiding this comment.
I would prefer to use single quotes instead of double quotes as we also use single quotes in the CLI 😄
But this is a personal preference of course.
| "keywords": [ | ||
| "office 365", | ||
| "microsoft 365", | ||
| "sharepoint framework", | ||
| "o365", | ||
| "m365", | ||
| "spfx", | ||
| "sharepoint online", | ||
| "sharepoint", | ||
| "microsoft teams", | ||
| "microsoft graph", | ||
| "microsoft flow", | ||
| "azure active directory", | ||
| "azure ad", | ||
| "azure", | ||
| "microsoft" | ||
| ], |
There was a problem hiding this comment.
Maybe a few additional keywords regarding power platform could be handy here
There was a problem hiding this comment.
@Jwaegebaert good catch, these are the same keywords we have in the main CLI repo, so we should consider also adding power platform there as well.
There was a problem hiding this comment.
I think these keywords need a review. Let's leave them as they are for now and work on a new set of keywords that we can apply across all of our repos.
There was a problem hiding this comment.
Good idea, I'll create an issue in the repo of the CLI with a suggestion and we can discuss it there.
| describe('validate', () => { | ||
|
|
||
| it('throws error if APP_FILE_PATH is not passed ', () => { |
There was a problem hiding this comment.
| describe('validate', () => { | |
| it('throws error if APP_FILE_PATH is not passed ', () => { | |
| describe('validate', () => { | |
| it('throws error if APP_FILE_PATH is not passed ', () => { |
| SKIP_FEATURE_DEPLOYMENT: false, | ||
| OVERWRITE: false | ||
| }; | ||
| assert.throws(() => validate(options), Error, `SCOPE must be either 'tenant' or Scope.SiteCollection.`); |
There was a problem hiding this comment.
| assert.throws(() => validate(options), Error, `SCOPE must be either 'tenant' or Scope.SiteCollection.`); | |
| assert.throws(() => validate(options), Error, 'SCOPE must be either 'tenant' or Scope.SiteCollection.'); |
| SKIP_FEATURE_DEPLOYMENT: false, | ||
| OVERWRITE: false | ||
| }; | ||
| assert.throws(() => validate(options), Error, `SITE_COLLECTION_URL is required if SCOPE is set to Scope.SiteCollection.`); |
There was a problem hiding this comment.
| assert.throws(() => validate(options), Error, `SITE_COLLECTION_URL is required if SCOPE is set to Scope.SiteCollection.`); | |
| assert.throws(() => validate(options), Error, 'SITE_COLLECTION_URL is required if SCOPE is set to Scope.SiteCollection.'); |
148dc84 to
4e35179
Compare
|
Thanks for the review comments @Jwaegebaert 👍 I've addressed the indenting and quoting comments by applying eslint rules so we fix the style going forwards. I've taken the approach of using no quotes > single quotes > double quotes for the I've also updated some of the npm scripts to bring them inline with the main CLI repo so that we have a more consistent developer experience. |
Jwaegebaert
left a comment
There was a problem hiding this comment.
Awesome idea to add the eslint rules. I noticed a few files still have a spacing of 4 instead of 2, but I commented on them. I also found another nice addition we could apply. Besides these, it looks good to go 😄
| - name: Use Node.js ${{ matrix.node }} | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.node }} | ||
| registry-url: "https://registry.npmjs.org" | ||
| - name: Cache node modules | ||
| id: cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| **/node_modules | ||
| key: node_modules-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | ||
| - name: Restore dependencies | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| run: npm ci | ||
| - name: Build | ||
| run: npm run build | ||
| - name: Compress output (non-Windows) | ||
| if: matrix.os != 'windows-latest' | ||
| run: tar -cvf build.tar --exclude node_modules ./ | ||
| - name: Compress output (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: 7z a -ttar -xr!node_modules -r build.tar . | ||
| - name: Upload build artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: build-${{ matrix.os }}-${{ matrix.node }} | ||
| path: build.tar |
There was a problem hiding this comment.
In .github/workflows/test.yml we have an empty line before a new task which looks quite neat. So a suggestion would be to apply it here as well 😄
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Cache node modules | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| **/node_modules | |
| key: node_modules-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | |
| - name: Restore dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Compress output (non-Windows) | |
| if: matrix.os != 'windows-latest' | |
| run: tar -cvf build.tar --exclude node_modules ./ | |
| - name: Compress output (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: 7z a -ttar -xr!node_modules -r build.tar . | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: build-${{ matrix.os }}-${{ matrix.node }} | |
| path: build.tar | |
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Cache node modules | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| **/node_modules | |
| key: node_modules-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | |
| - name: Restore dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Compress output (non-Windows) | |
| if: matrix.os != 'windows-latest' | |
| run: tar -cvf build.tar --exclude node_modules ./ | |
| - name: Compress output (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: 7z a -ttar -xr!node_modules -r build.tar . | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: build-${{ matrix.os }}-${{ matrix.node }} | |
| path: build.tar |
| - name: Configure pagefile | ||
| if: matrix.os == 'windows-latest' | ||
| uses: al-cheb/[email protected] | ||
| with: | ||
| minimum-size: 16GB | ||
| maximum-size: 16GB | ||
| disk-root: "C:" | ||
| - uses: actions/download-artifact@v3 | ||
| with: | ||
| name: build-${{ matrix.os }}-${{ matrix.nodeBuild }} | ||
| - name: Unpack build artifact (non-Windows) | ||
| if: matrix.os != 'windows-latest' | ||
| run: tar -xvf build.tar && rm build.tar | ||
| - name: Unpack build artifact (Windows) | ||
| if: matrix.os == 'windows-latest' | ||
| run: 7z x build.tar && del build.tar | ||
| - name: Use Node.js ${{ matrix.nodeRun }} | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ matrix.nodeRun }} | ||
| registry-url: "https://registry.npmjs.org" | ||
| - name: Cache node modules | ||
| id: cache | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| **/node_modules | ||
| key: node_modules-${{ matrix.os }}-${{ matrix.nodeBuild }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | ||
| - name: Restore dependencies | ||
| if: steps.cache.outputs.cache-hit != 'true' | ||
| run: npm ci | ||
| - name: Test without coverage | ||
| run: npm test | ||
| - name: Test with coverage | ||
| run: npm run test:cov | ||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: coverage-${{ matrix.os }}-${{ matrix.nodeRun }} | ||
| path: coverage.tar No newline at end of file |
There was a problem hiding this comment.
Let's add an empty line before every task.
| - name: Configure pagefile | |
| if: matrix.os == 'windows-latest' | |
| uses: al-cheb/[email protected] | |
| with: | |
| minimum-size: 16GB | |
| maximum-size: 16GB | |
| disk-root: "C:" | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: build-${{ matrix.os }}-${{ matrix.nodeBuild }} | |
| - name: Unpack build artifact (non-Windows) | |
| if: matrix.os != 'windows-latest' | |
| run: tar -xvf build.tar && rm build.tar | |
| - name: Unpack build artifact (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: 7z x build.tar && del build.tar | |
| - name: Use Node.js ${{ matrix.nodeRun }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.nodeRun }} | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Cache node modules | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| **/node_modules | |
| key: node_modules-${{ matrix.os }}-${{ matrix.nodeBuild }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | |
| - name: Restore dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Test without coverage | |
| run: npm test | |
| - name: Test with coverage | |
| run: npm run test:cov | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: coverage-${{ matrix.os }}-${{ matrix.nodeRun }} | |
| path: coverage.tar | |
| - name: Configure pagefile | |
| if: matrix.os == 'windows-latest' | |
| uses: al-cheb/[email protected] | |
| with: | |
| minimum-size: 16GB | |
| maximum-size: 16GB | |
| disk-root: "C:" | |
| - uses: actions/download-artifact@v3 | |
| with: | |
| name: build-${{ matrix.os }}-${{ matrix.nodeBuild }} | |
| - name: Unpack build artifact (non-Windows) | |
| if: matrix.os != 'windows-latest' | |
| run: tar -xvf build.tar && rm build.tar | |
| - name: Unpack build artifact (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: 7z x build.tar && del build.tar | |
| - name: Use Node.js ${{ matrix.nodeRun }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.nodeRun }} | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Cache node modules | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| **/node_modules | |
| key: node_modules-${{ matrix.os }}-${{ matrix.nodeBuild }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | |
| - name: Restore dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Test without coverage | |
| run: npm test | |
| - name: Test with coverage | |
| run: npm run test:cov | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| name: coverage-${{ matrix.os }}-${{ matrix.nodeRun }} | |
| path: coverage.tar |
| @@ -0,0 +1,35 @@ | |||
| { | |||
| "root": true, | |||
There was a problem hiding this comment.
Here we also have a spacing of 4 instead of 2
| @@ -0,0 +1,24 @@ | |||
| export interface SpoApp { | |||
| CheckInComment: string, | |||
There was a problem hiding this comment.
Here we also have a spacing of 4 instead of 2
| export interface Options { | ||
| APP_FILE_PATH: string; | ||
| SCOPE: Scope; | ||
| SITE_COLLECTION_URL: string; | ||
| SKIP_FEATURE_DEPLOYMENT: boolean; | ||
| OVERWRITE: boolean; | ||
| } | ||
|
|
||
| export enum Scope { | ||
| Tenant = 'tenant', | ||
| SiteCollection = 'sitecollection' | ||
| } |
There was a problem hiding this comment.
Here we also have a spacing of 4 instead of 2
| export interface Options { | |
| APP_FILE_PATH: string; | |
| SCOPE: Scope; | |
| SITE_COLLECTION_URL: string; | |
| SKIP_FEATURE_DEPLOYMENT: boolean; | |
| OVERWRITE: boolean; | |
| } | |
| export enum Scope { | |
| Tenant = 'tenant', | |
| SiteCollection = 'sitecollection' | |
| } | |
| export interface Options { | |
| APP_FILE_PATH: string; | |
| SCOPE: Scope; | |
| SITE_COLLECTION_URL: string; | |
| SKIP_FEATURE_DEPLOYMENT: boolean; | |
| OVERWRITE: boolean; | |
| } | |
| export enum Scope { | |
| Tenant = 'tenant', | |
| SiteCollection = 'sitecollection' | |
| } |
| @@ -0,0 +1,11 @@ | |||
| { | |||
| "extension": [ | |||
There was a problem hiding this comment.
Here we also have a spacing of 4 instead of 2
Jwaegebaert
left a comment
There was a problem hiding this comment.
Great job on this one, @garrytrinder! I don't have anything else to add to this PR, so it's a go from me 😄
816f228 to
d2dcbb6
Compare
|
Thanks again @Jwaegebaert 👍 I managed to fix the eslint rules so that we can now detect errors in the interfaces and enums which were previously being ignored. Thanks again for your attention to detail ❤️ |
d2dcbb6 to
fd83463
Compare
Merging this PR will
node@16v4.0.0(see https://github.blog/changelog/2022-05-20-actions-can-now-run-in-a-node-js-16-runtime/).DS_Storefile