Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the build onto windows #26

Open
2 tasks
searls opened this issue Jul 18, 2016 · 7 comments
Open
2 tasks

Get the build onto windows #26

searls opened this issue Jul 18, 2016 · 7 comments

Comments

@searls
Copy link
Member

searls commented Jul 18, 2016

I mistakenly thought this repo had Appveyor set up already (like scripty does).

Things teenytest should do:

  • work on windows
  • its full build should work on windows, too
This was referenced Jul 18, 2016
@searls
Copy link
Member Author

searls commented Sep 28, 2016

Teenytest seems to run OK on windows as evidenced by this https://ci.appveyor.com/project/searls/test-smells/build/1.0.37

I think the core issue is our build won't itself work on Windows b/c of all the unix hackery

@searls searls changed the title Add support for Windows Get the build onto windows Sep 28, 2016
@webstech
Copy link
Contributor

webstech commented Feb 6, 2023

Documenting my Windows experience. Maybe this can go in a wiki page the README.md can point to. There have been a number of changes in the tests since this issue was opened. Hopefully this can be helpful. The main issues encountered:

  • symlinks - even when these are created okay, git status may show changes on the Windows command prompt
  • end of line
  • shebang expectations
    This should be mostly accurate but it is the notes from three concurrent setups. The learning curve started with the worst scenario - cloning in a Windows command prompt.

Installation on Windows

It is recommended to have Windows Subsystem for Linux (wsl) installed. This provides a complete Linux environment. It also provides a Windows native version of bash.

  1. Run git clone in a wsl window. This will create symlinks and proper linefeed characters.
  2. Run git clone in a command prompt. To handle symlinks and linefeed, specify -c core.autocrlf=false -c core.eol=lf -c core.symlinks=true on the git command. If symlinks can not be created, you will get error messages such as error: unable to create symlink example/esm-node/node_modules/.bin/teenytest: Permission denied. There are eight symlinks (a workaround is described below).
  3. Run git clone under bash in a command prompt: bash -c "git -c core.autocrlf=false -c core.eol=lf -c core.symlinks=true clone https://github.com/<your github id>/teenytest.git". This will create the symlinks and proper linefeed.

Running tests on Windows

  1. Run in a wsl window. The tests all work if cloned in wsl or bash.
  2. Run in a command prompt. test:safe and test:safe:bats will not run.
  3. Run in a command prompt under bash: bash -c "npm run test". The tests will run if cloned in wsl or bash.

Making it Work

  1. test:safe - change package.json to "test:safe": "node ./safe/support/runner.js",
  2. test:safe:bats - this requires bash, so either change package.json to "test:safe:bats": "bash -c 'bats --tap --recursive safe'", or always run with bash -c "npm run test:safe:bats".
  3. lineend issues - bin/teenytest and safe\teenytest.bats must be saved with lineend = lf.
  4. symlinks
    Change all references to ../plugins/*printer* to ../../vanilla/plugins/*printer* (4 files).
  5. more shebang/symlink
  • example\esm-node\package.json needs to specify "test": "node ../../bin/teenytest"
  • example\*\node_modules\.bin\teenytest need to specify ../../bin/teenytest "$@" .

@webstech
Copy link
Contributor

webstech commented Feb 6, 2023

Regarding the previous comment, several items under Making it Work can be done and should not cause a problem for any platform.

There are other win32 issues with child_process.spawn that other issues linked in this issue mention. These will be addressed separately.

@webstech
Copy link
Contributor

webstech commented Feb 6, 2023

PRs #74 and #75 have been opened to improve Windows support.

@searls
Copy link
Member Author

searls commented Feb 12, 2023

Hi @webstech -- thanks for putting in the effort to get us closer here. I merged your two PRs and added a github action to monitor progress. I also updated all dependencies and cut a release as v6.0.4

@searls
Copy link
Member Author

searls commented Feb 12, 2023

@webstech Here's an example of where the windows build is failing in CI https://github.com/testdouble/teenytest/actions/runs/4156748629/jobs/7190751458

@webstech
Copy link
Contributor

@searls I opened a PR implementing the changes listed above under 'Making it Work'. No issue if you disagree with the directions I chose - just trying to get it to work.

I noticed a difference in the tests between platforms that I have not researched. test:unit has 9 tests on bashy platforms and 10 tests on Windows. The missing test is:

ok 10 - "counts the number of deeply nested things with 'type' test" - test #1 in `test/plugins/tap13/count-tests-test.js`

Seems like ** in the glob did not get the multi-level subdirs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants