Skip to content

CLI Test case does not ignore *.DS_Store #2833

@gerteck

Description

@gerteck

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

No response

Tell us about your environment

MacOS

MarkBind version

6.2.0

Describe the bug and the steps to reproduce it

Gets this issue (testcase failure)

gerteck@r-254-98-25-172 markbind % cd packages/cli
gerteck@r-254-98-25-172 cli % npm run test

> markbind-cli@6.2.0 test
> jest --colors && cd test/functional && node test.js

 PASS  test/unit/ipUtil.test.js
 PASS  test/unit/cliUtil.test.js
------------|---------|----------|---------|---------|-------------------
File        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------|---------|----------|---------|---------|-------------------
All files   |    97.5 |    94.11 |     100 |    97.5 |                   
 cliUtil.js |   96.29 |     90.9 |     100 |   96.29 | 21                
 ipUtil.js  |     100 |      100 |     100 |     100 |                   
------------|---------|----------|---------|---------|-------------------

Test Suites: 2 passed, 2 total
Tests:       17 passed, 17 total
Snapshots:   0 total
Time:        0.705 s, estimated 2 s
Ran all test suites.
info: The following errors are expected to be thrown during the test run:
info: 1: URLs are not allowed in the 'src' attribute
info: 2: No config file found in parent directories of
info: 3: This directory does not appear to contain a valid MarkBind site. Check that you are running the command in the correct directory!
Running test_site tests
  __  __                  _      ____    _               _ 
 |  \/  |   __ _   _ __  | | __ | __ )  (_)  _ __     __| |
 | |\/| |  / _` | | '__| | |/ / |  _ \  | | | '_ \   / _` |
 | |  | | | (_| | | |    |   <  | |_) | | | | | | | | (_| |
 |_|  |_|  \__,_| |_|    |_|\_\ |____/  |_| |_| |_|  \__,_|
                                                           
 v6.2.0
info: Website generation started at 3:07:53 PM
info: Building assets...
info: Assets built
info: Generating pages...
warn: panel has a header slot, 'header' attribute has no effect.
warn: modal has a header slot, 'header' attribute has no effect.
warn: popover has a content slot, 'content' attribute has no effect.
warn: popover has a header slot, 'header' attribute has no effect.
warn: popover has a content slot, 'content' attribute has no effect.
warn: popover has a 'content' attribute, 'src' attribute has no effect.
warn: popover has a content slot, 'content' attribute has no effect.
warn: popover has a content slot, 'src' attribute has no effect.
warn: popover has a content slot, 'src' attribute has no effect.
error: URLs are not allowed in the 'src' attribute
      File: /Users/gerteck/dev/markbind/packages/cli/test/functional/test_site/testPopovers.md
      URL provided: http://www.shouldnotwork.com
      
      Please check the `src` attribute in the popover element.
      Ensure it doesn't contain a URL (e.g., "http://www.example.com").
[=========================================================] 57 / 57 pages built
warn: You might have an invalid intra-link! Ignore this warning if it was intended.
'/test_site/bugs/LINK_TO_MARKBIND_ISSUE' found in file '/Users/gerteck/dev/markbind/packages/cli/test/functional/test_site/bugs/index.md'
warn: You might have an invalid intra-link! Ignore this warning if it was intended.
'/test_site/asdf' found in file '/Users/gerteck/dev/markbind/packages/cli/test/functional/test_site/testThumbnails.md'
warn: You might have an invalid intra-link! Ignore this warning if it was intended.
'/broken_link' found in file '/Users/gerteck/dev/markbind/packages/cli/test/functional/test_site/testThumbnails.md'
info: Pages built
info: Site data built
info: Website generation complete! Total build time: 6.883s
info: Build success!
Error: Unequal number of files! Expected: 217, Actual: 218
    at compare (/Users/gerteck/dev/markbind/packages/cli/test/functional/testUtil/compare.js:99:11)
    at /Users/gerteck/dev/markbind/packages/cli/test/functional/test.js:56:5
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/gerteck/dev/markbind/packages/cli/test/functional/test.js:51:11)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49
Test result: test_site FAILED
npm error Lifecycle script `test` failed with error:
npm error code 1
npm error path /Users/gerteck/dev/markbind/packages/cli
npm error workspace markbind-cli@6.2.0
npm error location /Users/gerteck/dev/markbind/packages/cli
npm error command failed
npm error command sh -c jest --colors && cd test/functional && node test.js
gerteck@r-254-98-25-172 cli % 

Expected behavior

2 things:

  • Add more logging specifically for which files are diff
  • Fix the DS_Store filtering

Implement something similar to

/**
* Filters out .page-vue-render.js files from the list of file paths.
* @param {string[]} filePaths - List of file paths
* @returns {string[]} Filtered list without *.page-vue-render.js files
*/
function filterPageVueRenderFiles(filePaths) {
return filePaths.filter(p => !p.endsWith('.page-vue-render.js'));
}

For filtering *.DS_Store, and probably combine the two together.

Also use lodash differences to highlight the diff files.

Pass testcase for CLI

Anything else?

Would not face this issue if we go ahead with #2831 ! ( I think)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions